File: cmplxfunc.dem

package info (click to toggle)
scilab 4.1.2-6
  • links: PTS, VCS
  • area: non-free
  • in suites: lenny
  • size: 113,992 kB
  • ctags: 65,732
  • sloc: ansic: 406,468; fortran: 242,412; xml: 223,812; tcl: 46,703; sh: 10,945; ml: 9,441; makefile: 4,697; cpp: 1,354; java: 926; csh: 260; yacc: 247; perl: 130; lex: 126; asm: 72; lisp: 30
file content (142 lines) | stat: -rw-r--r-- 4,229 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
// demo pour visualisation des fonctions elementaires
// complexe - Bruno Pincon 

getf("SCI/demos/cmplxfunc/MacCmplx.sci")  //  les macros utilisees ici

my_win = max(winsid())+1;

xset("window", my_win);
xset("default")
xset("wdim",700,450)
 
items = ["log"  ; "exp"  ;
	 "tan"  ; "atan" ;
	 "sin"  ; "asin" ;
	 "cos"  ; "acos" ;
	 "sinh" ; "asinh";
	 "cosh" ; "acosh";
	 "tanh" ; "atanh"; "custom"];

Title = ["visualisation of  complex";
         "elementary  functions  on";
	 "a centered disk or square";
	 "                         ";
	 "    Choose a function    "];

title_custom = ["---BE CAREFUL NOTHING IS PROTECTED---";
		"                                     ";
		" To draw your own complex  function :";
		"                                     ";
		"1/ define the  function by a correct ";
		"   string where  the complex var must";
		"   be z ; also  as  the function will";
		"   be evaluated  on  a matrix  don''t ";
		"   forget the . to operate in element";
		"   wize meaning ; examples :         ";
		"   z.^2     (z+1).*(z-1)   (1)./(z+2)";
		"   sqrt(z)  (z+%i).*(z-%i) 1+2*z+z.^2";
		"                                     ";
		"2/ define the type of the domain     ";
		"   string Square or Disk             ";
		"                                     ";
		"3/ define the ""radius"" R of the domain";
		"                                     ";
		"4/ may be your function has a kind of";
		"   discontinuity on Ox  or  Oy => put";
		"   the string Ox or Oy or No if not  "];
	

title_items_custom = ["1/ string     ";
		      "2/ Type Domain";
		      "3/ R          ";
		      "4/ Cut on Axe "];

rep_init = ["(1)./((z+2).*(2-z))";"Disk";"1.9";"No"];
rep = rep_init;       

while %t
  [num]=x_choose(items,Title);
  if num == 0 then , xdel(my_win) , break , end
  
  xbasc()
  select items(num)
    
  // PlotCmplxFunc(R,e,TypeDomain,TypeCut,n,StrFunc,theta,alpha,DomReal)
  case "log"
     R = 4;  e = 0.001; theta = 30; alpha = 60;
     PlotCmplxFunc(R,e,"Disk","Ox",[40 20],"log",theta,alpha,[e,R])

  case "exp"
     R = 2; theta = -130; alpha = 73;
     PlotCmplxFunc(R,0,"Disk","Ox",[40 20],"exp",theta,alpha,[-R,R])

  case "tan"
     R = %pi/2-0.15; theta = -130; alpha = 73;
     PlotCmplxFunc(R,0,"Square","Ox",41,"tan",theta,alpha,[-R,R])

  case "atan"
     R = 2 ; theta = -110; alpha = 75;
     PlotCmplxFunc(R,0.001,"Square","Oy",41,"atan",theta,alpha,[-R,R])
   
  case "cos"
     R = %pi; theta = 18; alpha = 43;
     PlotCmplxFunc(R,0,"Disk","Ox",[40 20],"cos",theta,alpha,[-R,R])

  case "acos"
     theta = -110; alpha = 75;
     PlotCmplxFunc(2,%eps,"Square","Ox",41,"acos",theta,alpha,[-1,1])

  case "sin"
     R = %pi; theta = -130; alpha = 73;
     PlotCmplxFunc(R,e,"Disk","Ox",[40 20],"sin",theta,alpha,[-R,R])

  case "asin"
     theta = -110; alpha = 75;
     PlotCmplxFunc(2,%eps,"Square","Ox",41,"asin",theta,alpha,[-1,1])

  case "sinh"
     R = %pi; e = 0; theta = -148; alpha = 60;
     PlotCmplxFunc(R,0,"Disk","Ox",[40 20],"sinh",theta,alpha,[-R,R])

  case "asinh"
     R = 2; theta = -110; alpha = 75;
     PlotCmplxFunc(2,%eps,"Square","Oy",41,"asinh",theta,alpha,[-R,R])

  case "cosh"
     R = %pi; e = 0; theta = -130; alpha = 56;
     PlotCmplxFunc(R,0,"Disk","Ox",[40 20],"cosh",theta,alpha,[-R,R])

  case "acosh"
     R = 2; theta = -110; alpha = 75;
     PlotCmplxFunc(R,%eps,"Square","Ox",41,"acosh",theta,alpha,[1,R])

  case "tanh"
     R = %pi/2-0.2; theta = -130; alpha = 73;
     PlotCmplxFunc(R,0,"Square","Ox",41,"tanh",theta,alpha,[-R,R])

  case "atanh"
     R = 2 ; theta = -110; alpha = 75;
     PlotCmplxFunc(R,0.001,"Square","Ox",41,"atanh",theta,alpha,[-0.99,0.99])

  case "custom"   // a voir !!!
     rep = x_mdialog(title_custom,title_items_custom, rep);
     if rep == [] then
	rep = rep_init
     else
        select rep(4)
        case "Ox" ; e = 0.001; TypeCut = "Ox";
	case "Oy" ; e = 0.001; TypeCut = "Oy";
	else e=0  ; TypeCut = "Ox" ; rep(4) = "No" ;
	end
	deff("Z=f(z)","Z="+rep(1))
	theta = -110; alpha = 75;
	R = evstr(rep(3));
	select rep(2)
	 case "Square"
	  PlotCmplxFunc(R,e,"Square",TypeCut,41,"f",theta,alpha,[0;0])
	 case "Disk"
	  PlotCmplxFunc(R,e,"Disk",TypeCut,[40 20],"f",theta,alpha,[0;0])
	end
     end
  end
end