~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to examples/interface-tour/ex17f.sce

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//Test inputs for ex17f:
 
2
X=1:3;Y=4:6;
 
3
//...and 3 examples of Scilab argument functions:
 
4
deff('z=f1(x,y)','z=x+y');
 
5
deff('z=f2(x,y)','z=x*x+y*y');
 
6
deff('z=f3(x,y)','z=cos(x+y)');
 
7
 
 
8
//reference values for Z calculated by feval
 
9
Zref1=feval(X,Y,f1);
 
10
Zref2=feval(X,Y,f2);
 
11
Zref3=feval(X,Y,f3);
 
12
 
 
13
// Calling ex17f with a argument function which is a Scilab function:
 
14
Z1=ex17f(X,Y,f1);
 
15
if norm(Z1-Zref1) > %eps then pause,end
 
16
 
 
17
Z2=ex17f(X,Y,f2);
 
18
if norm(Z2-Zref2) > %eps then pause,end
 
19
 
 
20
Z3=ex17f(X,Y,f3);
 
21
if norm(Z3-Zref3) > %eps then pause,end
 
22
 
 
23
// Calling ex17f with a argument function which is a Fortran function:
 
24
Z1=ex17f(X,Y,'f1f');     // f1f defined in ex17f.f
 
25
if norm(Z1 - Zref1) > %eps then pause,end
 
26
 
 
27
Z2=ex17f(X,Y,'f2f');   // f2f defined in ex17f.f
 
28
if norm(Z2 - Zref2) > %eps then pause,end
 
29
 
 
30
// making f3f.o and linking f3f dynamically with Scilab
 
31
if ~c_link('f3f') then 
 
32
  files=G_make(['f3f.o'],'f3f.dll');
 
33
  link(files,'f3f','f') ;
 
34
end
 
35
 
 
36
// Calling ex17f with the Fortran argument function fp3
 
37
Z3=ex17f(X,Y,'f3f');
 
38
if norm(Z3 - Zref3) > %eps then pause,end
 
39
 
 
40