Support Knowledge Base

Solution Number: 1019
Title: Can I solve systems of nonlinear algebraic equations with COMSOL?
Platform: All Platforms
Applies to: COMSOL Script
Versions: 3.3, 3.4
Created: December 6, 2007
Last Modified: August 15, 2008
Categories: PDEs, ODEs, and other equations
Keywords: fsolve daskp

Problem Description

Can I solve nonlinear equation systems with COMSOL?

Solution

Yes, you can. The easiest way is to use the daspk solver from the COMSOL Script command line. This is a solver for

  • Systems of ordinary differential equations (ODEs)
  • Mixed systems of differential and algebraic equations (DAEs)

For the special case when all time derivatives are zero, we get an algebraic, possibly nonlinear, equation system. Here is an example:

Equations

With x=2.5, y=6 as start guesses, the code

f = inline('[y(1)^2+3*y(2)^2-84 3*y(1)+log(y(2))-10.609]','t','y');
[t y] = daspk(f, [0 1], [2.5 6], odeset('Mass', zeros(2)));
y(end, :)

Generates the output

ans =

2.9999     5.0000

For more information, see help daspk.

See also: Solution 1007 for solution of algebraic equations in the COMSOL Multiphysics GUI, for coupled Algebraic-ODE-PDE systems.

Feedback

Poor | Excellent
Document quality?




« Back to Support Knowledge Base

Disclaimer

COMSOL makes every reasonable effort to verify the information you view on this page. Resources and documents are provided for your information only, and COMSOL makes no explicit or implied claims to their validity. COMSOL does not assume any legal liability for the accuracy of the data disclosed. Any trademarks referenced in this document are the property of their respective owners. Consult your product manuals for complete trademark details.

COMSOL RSS
© 1997-2008 COMSOL AB.
COMSOL, COMSOL Multiphysics, COMSOL Reaction Engineering Lab, COMSOL Script and
FEMLAB are registered trademarks of COMSOL AB. Other product or brand names are
trademarks or registered trademarks of their respective holders. All Rights Reserved.