Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
162 views
in Technique[技术] by (71.8m points)

Simple programming techniques / tricks in Mathematica for making graphics for the math book?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Here is a simple/basic way to do the first one:

Graphics[{

 (* The dashed circle segment *)
 {
  Dashing[{.04, .01}], 
  Darker[Orange], 
  AbsoluteThickness[2], 
  Circle[{0, 0}, 1, {1, 2 [Pi]}]
 },

 (* The solid circle segment *)
 {
  Orange, 
  AbsoluteThickness[2], 
  Circle[{0, 0}, 1, {0, 1}]
 },

 (* The radial lines and the small circle segment *)
 Line[{{0, 0}, {1, 0}}],
 Line[{{0, 0}, {Cos[1], Sin[1]}}],
 Circle[{0, 0}, .2, {0, 1}],

 (* Various text labels *)
 {
  Text[Style["[Theta]", 24], .3 {Cos[.5], Sin[.5]}], 
  Text[Style["s", 24], 1.1 {Cos[.5], Sin[.5]}], 
  Text[Style["r", 24], {.5, -.1}]
 }
}]

Mathematica graphics

The following is the exact same thing, but wrapped in Manipulate and parameterized on the angle alpha:

Manipulate[
 Graphics[{
  {Dashing[{.04, .01}], Darker[Orange], AbsoluteThickness[2], 
  Circle[{0, 0}, 1, {[Alpha], 2 [Pi]}]},
  {Orange, AbsoluteThickness[2], Circle[{0, 0}, 1, {0, [Alpha]}]},
  Line[{{0, 0}, {1, 0}}],
  Line[{{0, 0}, {Cos[[Alpha]], Sin[[Alpha]]}}],
  Circle[{0, 0}, .2, {0, [Alpha]}],
  {Text[Style["[Theta]", 
  24], .3 {Cos[[Alpha]/2], Sin[[Alpha]/2]}], 
  Text[Style["s", 24], 1.1 {Cos[[Alpha]/2], Sin[[Alpha]/2]}], 
  Text[Style["r", 24], {.5, -.1}]}
 }],
{{[Alpha], 1}, 0, 2 [Pi]}]

If you move the slider, the content will change accordingly:

Mathematica graphics


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...