Skip to main content
14-Alexandrite
January 8, 2022
Solved

Newton-Raphson method

  • January 8, 2022
  • 2 replies
  • 8053 views

Hello everyone,

 

I am working on a specific case and I have a problem writing the correct code. Let me explain it.

The file is attached. Even though some parameters are red, they are all known. I just had too much data to include in the file, and I just wanted to keep it simple.

 

My goal is to obtain n1,n2,n3,n4,n5 coefficients, along with T1new, such that f(T) for this T1new will be equal to zero. Moreover, f1,f2,f3,f4,f5 must be equal to zero as well. As a result, I want to achieve such n1-n5 and T1new, that f1-f5 will be zero and f(T1new) will be zero. All other parameters are known. I am not even sure if I am on the right track to find the solution.

Any help would be appreciated.

 

Regards

Murarz

 

 

Best answer by StuartBruff

@Murarz wrote:

Of course, I did not see the post. Let me prepare the file. I had to lock some areas, as it is part of my project and I am not allowed to distribute it.

 

In one area, which is unclocked, there are definitions of K(T). 


OK.  I finished doing my other tasks rather later than I hoped, so I haven't checked the attached M15 and MP7 worksheets too closely.   I've validated the new Newton-Raphson function against a few examples I found.  The solution to your equations doesn't look correct (negative T1).  However, the method is sensitive to initial values and it might be worth checking those.

 

The MP7 version (directly converted from the M15 worksheet and recalculated) isn't showing what I'd expect from Example Three's Jacobian symbolic evaluation. ðŸ¤” I've played around with font, variable names and styles without much luck but it's too far past my bedtime to look at it in any more detail. ðŸ˜´  It works as I would expect in M15.

 

Stuart

 

 

2 replies

24-Ruby III
January 8, 2022

 Hi Muratz,

 

Take a look at the finished listing of the program here: https://community.ptc.com/t5/PTC-Mathcad/newton-raphson-method-mathcad-15-HELP/td-p/70305

Murarz14-AlexandriteAuthor
14-Alexandrite
January 8, 2022

Hi,

 

Yes, I have seen that post. But it did not help me, that's why I created a new post 😄 The thing is, I am not sure how to include the condition that f1-f5 should be equal to zero by manipulating only n1-n5 parameters. So basically, I want to solve the system of 6 equations and 6 unknows iteratively 

23-Emerald V
January 8, 2022

Is there a particular reason you are trying to Newton-Raphson?   Have you looked at using a Solve block?

 

Stuart

 

I don't know if it's applicable to your problem (I haven't had time to look through it properly) but is the following of some potential use?

 

https://community.ptc.com/t5/PTC-Mathcad/Hooke-Jeeves-function-TOMS178/m-p/65033#M25776

21-Topaz II
January 9, 2022

Hi!
I point out that there are 64 constants to define + nfuel. I have assigned increasing numerical values to which you will then give the actual values. So it turns out:

Answer to Murarz.jpg

Murarz14-AlexandriteAuthor
14-Alexandrite
January 9, 2022

Thank you very much for your help. nfuel is a constant as well and it is equal to 1. It seems that there is no stable solution. But I guess this code does not impose a condition that f1-f5 should be zero? Or does it matter in this case? I guess regardless of this additional condition, there will be no solution?

 

Because the point was to do this procedure iteratively. at first we assume n1-n5, to calculate f1-f5, then, we want such n1-n5 so that f1-f5 will be zero. THen, we calculate the temperature. If the temperature difference between the assumed value and the resultant one is greater than 0.1, then the code takes this newly calculated temperature and repeats the process by calculating again f1-f5 and so on. If the temperature difference is smaller than 0.1, the procedure stops.

23-Emerald V
January 9, 2022

@Murarz wrote:

Thank you very much for your help. nfuel is a constant as well and it is equal to 1. It seems that there is no stable solution. But I guess this code does not impose a condition that f1-f5 should be zero? Or does it matter in this case? I guess regardless of this additional condition, there will be no solution?


I suspect that the f1..f5 condition is important, hence the suggested vector approach,

 

Stuart