2 * Introduction to mnewton::
3 * Functions and Variables for mnewton::
6 @c -----------------------------------------------------------------------------
7 @node Introduction to mnewton, Functions and Variables for mnewton, mnewton-pkg, mnewton-pkg
8 @section Introduction to mnewton
9 @c -----------------------------------------------------------------------------
11 @code{mnewton} is an implementation of Newton's method for solving nonlinear
12 equations in one or more variables.
14 @opencatbox{Categories:}
15 @category{Numerical methods}
16 @category{Share packages}
17 @category{Package mnewton}
20 @c -----------------------------------------------------------------------------
21 @node Functions and Variables for mnewton, , Introduction to mnewton, mnewton-pkg
22 @section Functions and Variables for mnewton
23 @c -----------------------------------------------------------------------------
25 @c -----------------------------------------------------------------------------
26 @anchor{newtonepsilon}
27 @defvr {Option variable} newtonepsilon
28 Default value: @code{10.0^(-fpprec/2)}
30 Precision to determine when the @code{mnewton} function has converged towards
31 the solution. If @code{newtonepsilon} is a bigfloat, then @code{mnewton}
32 computations are done with bigfloats. See also @mrefdot{mnewton}
34 @opencatbox{Categories:}
35 @category{Package mnewton}
39 @c -----------------------------------------------------------------------------
40 @anchor{newtonmaxiter}
41 @defvr {Option variable} newtonmaxiter
42 Default value: @code{50}
44 Maximum number of iterations to stop the @code{mnewton} function
45 if it does not converge or if it converges too slowly.
47 See also @mrefdot{mnewton}
49 @opencatbox{Categories:}
50 @category{Package mnewton}
54 @c -----------------------------------------------------------------------------
56 @deffn {Function} mnewton (@var{FuncList},@var{VarList},@var{GuessList})
58 Multiple nonlinear functions solution using the Newton method.
59 @var{FuncList} is the list of functions to solve,
60 @var{VarList} is the list of variable names, and
61 @var{GuessList} is the list of initial approximations.
63 The solution is returned in the same format that @code{solve()} returns.
64 If the solution is not found, @code{[]} is returned.
66 This function is controlled by global variables @mref{newtonepsilon} and
67 @mrefdot{newtonmaxiter}
69 See also @mrefcomma{realroots} @mrefcomma{allroots} @mref{find_root} and
73 (%i1) load("mnewton")$
75 (%i2) mnewton([x1+3*log(x1)-x2^2, 2*x1^2-x1*x2-5*x1+1],
77 (%o2) [[x1 = 3.756834008012769, x2 = 2.779849592817897]]
78 (%i3) mnewton([2*a^a-5],[a],[1]);
79 (%o3) [[a = 1.70927556786144]]
80 (%i4) mnewton([2*3^u-v/u-5, u+2^v-4], [u, v], [2, 2]);
81 (%o4) [[u = 1.066618389595407, v = 1.552564766841786]]
84 The variable @code{newtonepsilon} controls the precision of the
85 approximations. It also controls if computations are performed with
91 (%i2) (fpprec : 25, newtonepsilon : bfloat(10^(-fpprec+5)))$
93 (%i3) mnewton([2*3^u-v/u-5, u+2^v-4], [u, v], [2, 2]);
94 (%o3) [[u = 1.066618389595406772591173b0,
95 v = 1.552564766841786450100418b0]]
98 To use this function write first @code{load("mnewton")}.
99 See also @mref{newtonepsilon} and @mrefdot{newtonmaxiter}
101 @opencatbox{Categories:}
102 @category{Package mnewton}