Obtaining numerical values from the mnewton function of the Maxima program

Viewed 33

I use Maxima for calculations. I solve a system of nonlinear equations using Newton's method (mnewton()). I get the solution in the form of a list: [[φ2=5.921818183272879,s=5.155870949147037]] How to get the numerical value of the first (φ2) and second (s) unknown. If I substitute: x: roz1[1][2]$ I get that x is equal to: s=5.155870949147037 What to do to make x equal to a numerical value only: 5.155870949147037 (without s=). My code: Maxima code

1 Answers

I have two ideas. (1) You can call rhs to return the right-hand side of an equation (likewise lhs for the left-hand side). E.g. rhs(s = 123) returns 123.

(2) You can call assoc to find the value associated with s (or any variable) in the mnewton results. E.g. assoc('s, [a = 1, b = 2, s = 3, u = 5]) returns 3.

I like (2) better since it is not necessary to know where in the list is the one that you're interested in.

Related