养生 装修 购物 美食 感冒 便秘 营销 加盟 小吃 火锅 管理 创业 搭配 减肥 培训 旅游

用Mathematica处理几何问题——点、线段

时间:2024-09-23 05:24:32

用Mathematica处理几何问题,是个非常明智的选择。济诌拢瘟她可以给出非常复杂的运算和结果,可以有效地避免大量硭腾蛲鳌计算。这有点类似于机器证明!下面就用Mathematica画各种几何图形。下面的代码,或多或少都有点错误。哈哈,我故意的!不过,你可以一边自学,一边就改过来了!这也可以帮助大家更好地熟练Mathematica!

用Mathematica处理几何问题——点、线段

用Mathematica处理几何问题——点、线段

用Mathematica处理几何问题——点、线段

工具/原料

电脑

Mathematica(8.0以上版本)

绘制点

1、绘制一个点:Graphics[Point[{2,3}]]注意点的坐标用{}括起来。

用Mathematica处理几何问题——点、线段

2、绘制多个点:Graphics[Point[Table[{t,Log[t]},{t,0.1,6,1/10}]]]

用Mathematica处理几何问题——点、线段

3、改变点的样式,粉红色的大点:Graphics[{PointSize[Large],Pink,Point[Table[{Cos[t],Sin[t]},{t,0,2\[Pi],\[Pi]/10}]]}]

用Mathematica处理几何问题——点、线段

4、绘制365个随机的点,颜色、大小、位置都是随机的:Graphics[Table[{Hue[RandomReal[]],PointSize[RandomReal[{0,0.1}]],Point[RandomReal[1,{2}]]},{365}]]这段代码每次运行,都可能会有不同的结果。

用Mathematica处理几何问题——点、线段

用Mathematica处理几何问题——点、线段

5、简单地把点分类,用Point画出来:【{red,green娅势毁歹}=Last@Reap@Scan[If[#[[1]]^2+#[[2]]^2&造婷用痃lt;2&&#[[1]]+#[[2]]<1,Sow[#,"Red"],Sow[#,"Green"]]&,RandomReal[{-2,2},{8888,2}]];Graphics[{{Red,Point[red]},{Green,Point[green]}}]】

用Mathematica处理几何问题——点、线段

绘制线段

1、线段,用Line实现。线段的端点的坐标,全放在{英文输入法的括号}里面:Graphics[Line[{{0,0},{3,4}}]】

用Mathematica处理几何问题——点、线段

2、画多条线段,围成一个三角形(折线段的端点,这些点的坐标,全放在{英文输入法的括号}里面)。Graphics[Line[{{0,0},{3,4},{0,4},{0,0}}]】

用Mathematica处理几何问题——点、线段

3、绘制不同样式的线段(注意{}的用法):l=Line[{{1,0},{2,3},{3,0},{5,1},{5,0},{6,1}}];Graphics[{Thick,l},ImageSize->{500,500}]】Graphics[{Thick,Dashed,Blue,l}】

用Mathematica处理几何问题——点、线段

用Mathematica处理几何问题——点、线段

4、绘制曲线的切向量(这里涉及微分几何的知识):With[{f屏顿幂垂={Cos[x]+Sin[2x],2Cos[x柯计瓤绘]+Sin[3x]}},Graphics[Table[{Hue[t/(2Pi),1,.8],Line[{f,Normalize[D[f,x]]+f}]}/.x->t,{t,0,2Pi,.05}]】和With[{f={Cos[3x]+Sin[2x],2Cos[x]+Sin[3x]}},Graphics[Table[{Hue[t/(2Pi),1,.8],Line[{f,Normalize[D[f,x]]+f}]}/.x->t,{t,0,2Pi,.05}]】

用Mathematica处理几何问题——点、线段

用Mathematica处理几何问题——点、线段

5、绘制有八个点的完全图(这是图论的知识):p=Tuples[Table[{Cos[t]+Sin[2t],Sin[t]},{t,0,2Pi,2Pi/8}],2];Graphics[Line[p]】

用Mathematica处理几何问题——点、线段

6、绘制曲线的切线簇(涉及射影几何、代数几何等理论):f[x_]咯悝滩镞:=x^2+xp=Table[{{a-2,f'[a]((a-2)惺绅寨瞀-a)+f[a]},{a+2,f'[a]((a+2)-a)+f[a]}},{a,-10,10,.1}];Graphics[Line[p],PlotRange->{{-1,1},{-1,1}}】

用Mathematica处理几何问题——点、线段

7、绘制摩尔的视觉误差条纹:Graphics[Table[Line[{{{x,0},{1-x,1}},{{0,x},{1,1-x}}}],{x,0,1,.02}]】

用Mathematica处理几何问题——点、线段

© 一点知识