1 # Created by Octave 3.6.1, Tue Mar 20 21:13:35 2012 UTC <root@t61>
13 # name: <cell-element>
17 -- Function File: VARS = findsym (F, N)
18 Find symbols in expression F and return them comma-separated in
19 string VARS. The symbols are sorted in alphabetic order. If N is
20 specified, the N symbols closest to "x" are returned.
28 vars2 = findsym (f,1);
30 This is intended for m****b compatibility, calls findsymbols().
38 # name: <cell-element>
42 Find symbols in expression F and return them comma-separated in string
47 # name: <cell-element>
54 # name: <cell-element>
58 -- Function File: P = poly2sym (C, X)
59 Creates a symbolic polynomial expression P with coefficients C.
60 If P is not specified, the free variable is set to sym("x"). C may
61 be a vector or a cell-array of symbols. X may be a symbolic
62 expression or a string. The coefficients correspond to decreasing
63 exponent of the free variable.
69 p = poly2sym ([2,5,-3]); # p = 2*x^2+5*x-3
70 c = poly2sym ({2*y,5,-3},x); # p = 2*y*x^2+5*x-3
72 See also: sym2poly, polyval, roots
78 # name: <cell-element>
82 Creates a symbolic polynomial expression P with coefficients C.
86 # name: <cell-element>
93 # name: <cell-element>
97 -- Function File: splot (F,X,RANGE)
98 Plot a symbolic function f(x) over range.
103 # name: <cell-element>
107 Plot a symbolic function f(x) over range.
111 # name: <cell-element>
118 # name: <cell-element>
122 -- Function File: C = sym2poly (P, X)
123 Returns the coefficients of the symbolic polynomial expression P
124 as a vector. If there is only one free variable in P the
125 coefficient vector C is a plain numeric vector. If there is more
126 than one free variable in P, a second argument X specifies the
127 free variable and the function returns a cell vector of symbolic
128 expressions. The coefficients correspond to decreasing exponent
129 of the free variable.
135 c = sym2poly (x^2+3*x-4); # c = [1,3,-4]
136 c = sym2poly (x^2+y*x,x); # c = {2,y,0}
138 If P is not a polynomial the result has no warranty.
140 See also: poly2sym, polyval, roots
146 # name: <cell-element>
150 Returns the coefficients of the symbolic polynomial expression P as a
155 # name: <cell-element>
162 # name: <cell-element>
166 -- Function File: [X, INF, MSG] = symfsolve (...)
167 Solve a set of symbolic equations using `fsolve'. There are a
168 number of ways in which this function can be called.
170 This solves for all free variables, initial values set to 0:
173 x=sym("x"); y=sym("y");
174 f=x^2+3*x-1; g=x*y-y^2+3;
177 This solves for x and y and sets the initial values to 1 and 5
180 a = symfsolve(f,g,x,1,y,5);
181 a = symfsolve(f,g,{x==1,y==5});
182 a = symfsolve(f,g,[1 5]);
184 In all the previous examples vector a holds the results: x=a(1),
185 y=a(2). If initial conditions are specified with variables, the
186 latter determine output order:
188 a = symfsolve(f,g,{y==1,x==2}); # here y=a(1), x=a(2)
190 The system of equations to solve for can be given as separate
191 arguments or as a single cell-array:
193 a = symfsolve({f,g},{y==1,x==2}); # here y=a(1), x=a(2)
195 If the variables are not specified explicitly with the initial
196 conditions, they are placed in alphabetic order. The system of
197 equations can be comma- separated or given in a cell-array. The
198 return-values are those of fsolve; X holds the found roots.
205 # name: <cell-element>
209 Solve a set of symbolic equations using `fsolve'.