This is a file from the Wikimedia Commons

File:N-th arm stars.svg

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Original file(SVG file, nominally 1,000 × 500 pixels, file size: 33 KB)

Summary

Description
English: n-th arm stars
Date
Source Own work
Author Adam majewski

Licensing

I, the copyright holder of this work, hereby publish it under the following licenses:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
GNU head Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.
You may select the license of your choice.

Maxima CAS source code

Software :

  • Maxima CAS
    • draw package by by Mario Rodriguez Riotorto [1]
  • gnuplot

Metaprogramming : scenes is a string which is used as an input for draw command

/* 
Adam Majewski
fraktal.republika.pl

*/

kill(all);
remvalue(all);


/* compute vectors at the given points  vector ([x,y], [dx,dy]) 
  vector([x,y], [dx,dy]) plots vector [dx,dy] with origin in [x,y]. 
*/


 

GiveCirclePoint(t):=rectform(%e^(%i*t*2*%pi)); /* gives point of unit circle for angle t in turns */



GiveVector(origin, target):=block(
 [x,y,dx,dy],
 x:realpart(origin),
 y:imagpart(origin),
 dx:realpart(target)-x,
 dy:imagpart(target)-y,
 vector([x,y],[dx,dy])
)$

GiveAttractingVector(origin):=GiveVector(origin, 0)$ /* from origin to 0 */
GiveRepellingVector(target):=GiveVector(0, target)$  /* from 0 to target */


GiveAttractingVectors(Denominator):=(
 [AttractingInternalAngles, AttractingCirclePoints,nMax],
 nMax:Denominator,
 AttractingInternalAngles:makelist(n/nMax ,n,1,nMax),
 AttractingCirclePoints:listify(map(GiveCirclePoint,AttractingInternalAngles )),
 listify(map(GiveAttractingVector,AttractingCirclePoints))
)$



GiveScene(sTitle, vector):=
gr2d(title= sTitle,
        user_preamble = "set border 0;set nokey;set size square;set noxtics ;set noytics;",
        yrange = [-1,1],
        xrange = [-1,1],
        [head_length=0.1, head_angle  = 10, color=blue],
        vector
        )$



compile(all);

/* ----------------*/




scenes:[];
for Denominator:1 thru 10 step 1 do
(
 
 scene:GiveScene(string(1/Denominator),GiveAttractingVectors(Denominator)),
 scenes:endcons(scene,scenes))$


/* ----------draw the vector field ----------------------------*/

draw(
     
 terminal  = 'svg,
    columns =5,
    file_name = "b", /* one can add path here */
    pic_width  = 1000,    /* Since Maxima 5.23, pic_width and pic_height are deprecated. */
    pic_height = 500,    /* See option dimensions. To get the same effect, write dimensions=[800,600] */
    scenes


)$
 
  

References

  1. Draw package by Mario Rodriguez Riotorto for Maxima CAS

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

1 November 2012

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current19:46, 22 February 2013Thumbnail for version as of 19:46, 22 February 20131,000 × 500 (33 KB)Soul windsurfer{{Information |Description ={{en|1=n-th arm stars}} |Source ={{own}} |Author =Adam majewski |Date =2012-11-01 |Permission = |other_versions = }}

Metadata