Skip to main content
1-Visitor
August 28, 2016
Solved

Non-linear system of equations with variable number of equation

  • August 28, 2016
  • 5 replies
  • 4926 views

 

Dear Mathcad Helper,

As shown in the attached sheet, I am trying to solve a non-linear system with 2N+5 equations.  Among the 2N+5 equations, there are N+1 equations for one type of conditions, N+1 equation for another type of conditions and 3 individual separate equations.

 

The number of unknowns is 2N+5.  The unknowns are grouped in one (N+1)-vector, one N-vector and another 3 separate unknowns.

Here are two questions:

  1. Is there a way to use correctly the range variable “i” in order to formulate in a compact manner the two types of conditions?  I have difficulties with the range variable “i”.
  2. Is the regrouping of unknowns within multiple separate arrays (i.e. B and η) legal within a Find function?  If not, what would be a nice solution?

  

Note:   So far, the only one way I have been able to solve (partially) the non-linear equation system is to defined N as a single integer value, to explicitly write all 2N+5 equations one by one, and to use explicitly all 2N+5 unknowns.

Thank you for your interest and comments,

 

Gery

 

 

Best answer by AlanStevens

" The function fX that you suggested might not be that easy to formulate with separate i and j values."

This is not difficult.  The attached shows how.  It solves for 7 values of B, 8 values of eta, and a single value for F, G and k.  It uses a fixed value of c.  If you want c to float as well you need to specify another independent equation.

Alan

5 replies

24-Ruby IV
August 28, 2016

See please my try to use i:=1...N in the block Given....

Three questions to the Solve-block

23-Emerald IV
August 28, 2016

Independently of the indexing, you should carefully check your equations.

The last equation in the solve block defines c as a function of 2, pi, k and T, while T is given as a constant.

That means that c can be calculated as soon as (only!) k is known, it means c is not independent of k, this equation is not independent and does not help (rather interferes) with finding your solution.

Success!

Luc

gfryns1-VisitorAuthor
1-Visitor
August 29, 2016

Luc,

You are right.  The Mathcad worksheet version I published is a trimmed down version.  Indeed, I could have remove one extra unknown of the problem in order to facilitate Mathcad work.  However, the stated problem was correct, was it not?

Thank you for your comment.

Gery

23-Emerald IV
August 28, 2016

Then I find that you've put the entire stuff in a single text block. While that may work (... I don't think it will), I strongly suggest you take it apart in separate text blocks and equations.

Success!
Luc

gfryns1-VisitorAuthor
1-Visitor
August 29, 2016

Luc,

Yes, this is an habit I developed a long time ago: work in one single text region and use Ctrl-Shift A to add equations.  I like to develop my Mathcad sheet with the final report in mind and to keep record of the thought process.  (The Mathcad worksheet version is a trimmed down version.)  The transfer of a Mathcad text region to MS Wordand the implementation of MS Word Style are straightforward.  I convinced several people to try and use this method.  They are still using it!  Yes, I have an "Internal Error" from time to time and I have to refresh the sheet by cutting and pasting back the entire text region.

I will  mention it in the original question from now on.

I never worked with Prime.  I would be interest to see if there is any additional usefull format and export features.

Thank you for your comment,

Gery

12-Amethyst
August 28, 2016

Hi Guery.

Attached is in one of the corrects paths, but have an issue for continue, which is that in that way you have 6 unknouns and 5 equations. The attached don't take all the equations at the same time, but at least take them one by one, thus can be used for some other iterative precess.

I'm courious about two things: As Luc Mentions, your style isn't the usual, and your naming style, too.

Best regards.

Alvaro.

gfryns1-VisitorAuthor
1-Visitor
September 1, 2016

Hi Alvari,

Before to look at an interative solution, I really wanted to resolve the problem in a similar fashion than what I showed in my original email.  In that respect Allen provide me with the prefered direction.

At the end, the problem, I am working with will be an iterative solution.

Thank you for trying.

Gery

19-Tanzanite
August 28, 2016

See if the attached helps.

Alan

19-Tanzanite
August 29, 2016

I've now looked at this a little more closely.  The only way the B terms enter the equations is as a sum over all its elements.  This means the individual components, as found by Mathcad, have no real meaning.  Only the sum has meaning, so one might as well replace the sum over j of Bj by the single scalar B.  This is what I've done in the attached.  The results change a little (as they do for different initial guesses for B).


(Note: the individual i terms involving the sinh's cosh's etc. are completely independent of the Bj's).

Alan

gfryns1-VisitorAuthor
1-Visitor
August 29, 2016

Hi Allan,

Thank you for your interest.  I must apologize: there is a mistake in my initial questions.  (I thought that I was able to correct it and resave it but I realized that the correction I made did not take effect.)  The sentence regarding the unknows should read:

"The number of unknowns is 2N+5.  The unknowns are grouped in one (N+1)-vector (h), one N-vector (B) and another 4 separate unknowns."

Again, B is a vector with N unknowns.

Allan Steven (Aug 28, 2016 1:24 PM) proposed a solution, which is almost correct.  The only issue is that  F must be a single constant (or an (N+1) vector with all equal elements), and that G must be a single constant as well (or an (N+1) array with all equal elements).

Again, thank you for your attempt.

Gery