小编500*_*500的帖子

Mathematica中笛卡尔坐标系中的计算距离

分析屏幕上的眼动,我将我的原点设置到它的左下角(那时难以修改).

试图计算某些点和屏幕中心之间的距离我使用下面显示的简单公式.问题是在条件语句中使用它会变得很难看.

Sqrt[
(
(fixationX - centerX)^2 + (fixationY - centerY)^2
)
]
Run Code Online (Sandbox Code Playgroud)

有没有办法定制Norm来计算点之间的距离,而不是点和原点之间的距离?

或者在我的情况下,将原点设置为当前坐标系的"中心"?

wolfram-mathematica distance norm cartesian

5
推荐指数
1
解决办法
765
查看次数

Mathematica中的最佳代码布局?

我现在已经看到了在这个论坛上布局代码的不同优雅方式.

作为初学者,我想就如下布局代码的最佳布局方式提出建议.

这是丑陋的,不是最优的,甚至可能是愚蠢的,但专家程序员可能会原谅我,我将其用作"最坏情况".

我是新手的目的是清晰.

rejection[disp_, fixationNOtoConsiderForDuration_, durationLimit_, 
 minDistance_] :=

With[{fakedata = consider[t4dataLAEH10, 9, disp, {17, 18, 11}]},

With[{num = 
 Flatten[Position[
   Take[fakedata[[All, 3]], fixationNOtoConsiderForDuration], 
   x_ /; (x > durationLimit)]]},

If[num =!= {},
With[{fakedata1 = Drop[fakedata[[All, {1, 2}]], Last@num]},
 With[{num1 =
    Flatten[Position[
      Table[     
       Sqrt[((fakedata1[[fixation1, 1]] - 
           centerX)^2 + (fakedata1[[fixation1, 2]] - 
           centerY)^2)],
       {fixation1, 1, Length@fakedata1}], 
      x_ /; (x < minDistance)]]},

  If[num1 =!= {},
   Delete[fakedata1[[All, {1, 2}]], List /@ num1], 
   fakedata[[All, {1, 2}]]]]],
With[{fakedata2 = fakedata[[All, {1, 2}]]},  
 With[{num2 =
    Flatten[Position[
      Table[       
       Sqrt[((fakedata2[[fixation2, …
Run Code Online (Sandbox Code Playgroud)

layout wolfram-mathematica

5
推荐指数
2
解决办法
529
查看次数

基于渐变的条件着色

请考虑 :

Manipulate[
Row[{
Graphics[Disk[]], 
Graphics[{
 Polygon[{{0, 0}, {3, 0}, {3, 1}, {0, 1}},
 VertexColors -> {White, Blend[{White, Blue}], 
 Blend[{White, Blue}], White}],
 Black, Thick,
 Line[{{i, 0}, {i, 1}}]}, ImageSize -> 300]}], 
{i, 0, 3}]
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

使用Szabolcs的梯度填充解决方案

如何使用位于黑线下方的颜色为磁盘着色?

graphics wolfram-mathematica

5
推荐指数
2
解决办法
259
查看次数

mathematica中的插值

请考虑以下分布:

rs={{400, 0.00929}, {410, 0.0348}, {420, 0.0966}, {430, 0.2}, {440, 0.328}, {450, 0.455}, 
    {460, 0.567}, {470, 0.676}, {480, 0.793}, {490, 0.904}, {500, 0.982}, {510, 0.997}, 
    {520,0.935}, {530, 0.811}, {540, 0.65}, {550, 0.481}, {560, 0.329}, {570,0.208}, 
    {580, 0.121}, {590, 0.0655}, {600, 0.0332}, {610, 0.0159}, {620, 0.00737}, 
    {630, 0.00334}, {640, 0.0015}, {650,0.000677}, {660, 0.000313}, {670, 0.000148}, 
    {680, 0.0000715}, {690,0.0000353}, {700, 0.0000178}}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

如何插入此分布以获取X轴上任何位置的点的值?

interpolation wolfram-mathematica mathematica-8

4
推荐指数
2
解决办法
826
查看次数

对数间距数

我想测试几个强度值.

我需要它们以对数间隔从1到1000.但我只使用1,10,100,1000,但我希望有更多的数据点,让我们说10.

如何在Mathematica中找到1到1000之间的10个对数间隔数?

logging wolfram-mathematica mathematica-8

4
推荐指数
2
解决办法
4198
查看次数

listPlot的多个指令

daList={{0.059, 0.298, 0.726, 0.735, 1.461, 2.311, 3.315}, 
        {0.05, 0.404,0.664, 0.782, 1.376, 2.328, 3.432}, 
        {0.087, 0.628, 0.986, 1.187,1.914, 3.481, 4.993}, 
        {0.073, 0.594, 0.975, 1.147, 2.019, 3.417,5.037}, 
        {0.143, 0.821, 1.442, 1.595, 2.983, 4.98, 7.604}, 
        {0.107,0.871, 1.431, 1.684, 2.964, 5.015, 7.394}}


ListPlot[daList,
         Joined -> True,
         PlotRange -> {{1, 7}, {0, 7}}, 
         PlotStyle -> {{Thick, Lighter[Red, .5]}, 
                       {Dashed, Black}, 
                       {Thick,Lighter[Red, .3]}, 
                       {Dashed, Black}, 
                       {Thick,Lighter[Red, .1]}, 
                       {Dashed, Black}},
         Prolog ->{GrayLevel[0.5], EdgeForm[Thickness[.005]], 
                   Rectangle[{1.01, 0.01}, {6.99, 6.99}]}]
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

如您所见,我需要为每一行指定不同的指令.

我希望Dashed Black Line成为Points(Joined-> False).

我还不能掌握分组指令方法 …

plot styles wolfram-mathematica mathematica-8

4
推荐指数
1
解决办法
1637
查看次数

交叉或解决

考虑以下 :

daList = {{541, 0.0593368}, {550, 0.298352}, {560, 0.72619}, {570,0.734982}, 
          {580, 1.46149}, {590, 2.31119}, {600, 3.31509}}
Run Code Online (Sandbox Code Playgroud)

每个子列表代表{x,y}坐标.

我需要找到Y等于1的x值.用眼睛大约575.

ListPlot[daList, 
        Joined -> True, 
        Epilog ->{Thick, Line[{{0, 1}, {600, 1}}]}]
Run Code Online (Sandbox Code Playgroud)

+来自PPT的红色部分的帮助来说明问题:

在此输入图像描述

可以插值直到找到1,但我想知道Mathematica中是否存在这个函数.

无论是计算.找到y = 1的X.或者可以是在x轴上报告线交点x坐标的图形.

wolfram-mathematica intersection solution

4
推荐指数
3
解决办法
3613
查看次数

对数图

考虑以下 :

daList={{1., 588.956}, {2.15443, 581.347}, {4.64159, 573.648}, 
        {10.,560.676}, {21.5443, 552.881}, {46.4159, 547.851}, 
        {100.,544.908}, {215.443, 543.407}, {464.159, 542.358}, 
        {1000., 541.452}}


ListPlot[daList, PlotStyle -> Directive[Thick, Red]]
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

如何让每个点沿x轴均匀分布.我猜一个对数范围?

plot wolfram-mathematica

4
推荐指数
2
解决办法
422
查看次数

匹配图例和绘图大小

请考虑 :

intense = Reverse[Round[Rationalize /@ N[10^Range[0, 3, 1/3]]]];
values = Range[0, 9/10, 1/10];

intensityLegend = Column[Prepend[MapThread[
                         Function[{intensity, values},
                         Row[{Graphics[{(Lighter[Blue, values]),
                         Rectangle[{0, 0}, {4, 1}], Black, 
                         Text[Style[ToString[intensity], 16, Bold], {2, .5}]}]}]],
                        {intense, values}], Text[Style["Photons Number", Bold, 15]]]];

IntersectionDp1={{1., 588.377}, {2.15443, 580.306}, {4.64159, 573.466}, {10.,560.664}, 
                 {21.5443, 552.031}, {46.4159, 547.57}, {100.,545.051}, 
                 {215.443, 543.578}, {464.159, 542.281}, {1000., 541.346}}


FindD1=ListLogLinearPlot[Map[List, IntersectionDp1], 
                  Frame -> True, 
                  AxesOrigin -> {-1, 0}, 
                  PlotMarkers -> 
                  With[{markerSize = 0.04}, {Graphics[{Lighter[Blue, #], Disk[]}], 
                       markerSize} & /@Range[9/10, 0, -1/10]], Filling -> Axis, …
Run Code Online (Sandbox Code Playgroud)

plot wolfram-mathematica mathematica-8

4
推荐指数
1
解决办法
1933
查看次数

Mathematica的日期格式

当我试图在Mathematica中绘制一些金融时间序列时,我刚遇到如下图所示的问题:

似乎2000年之后不再处理这些数据了

有办法解决这个问题吗?

什么是从Bloomberg或Excel导出时间序列以在Mathematic中使用它们的最佳格式(使用版本8).

我知道FinancialData函数.但是,由于不知道确切的符号,因此直接使用Mathematica非常困难.

在此输入图像描述

datetime wolfram-mathematica quantitative-finance

4
推荐指数
2
解决办法
1607
查看次数