- #1

- 18

- 0

[Note from mentor: This thread was originally posted in a non-homework forum, therefore it does not follow the standard homework template.]

------------------------------------------------

Hello.

I have some homework to do. I need to make program that finds minimum/maximum of a function od 2 variables in Fortran. I'm thinking of just do it for a polynom.

For start, I'm researching online, what's the best way.

I imagine it this way:

1. input the polynom and parse it

2. every parsed particle, derivate by the rule

3. partial derivativy by x and y must be ==0

4.solve set of equations

5. get values

6. for every (x,y) which may be minimum or maximum, calculate 2.derivative

7.make Hessian matrix

8. calculate det(H) and then look for first particle in Hessian

9.according to 8), decide if the T(x,y) is minimum, maximum or neither.

The thing that bothers me mostly is 1) and 2). As far as I know, it's very difficult to make symbolic derivative in Fortran, it's much easier to do automatic derivative(in exact point of x and y)

So, at the moment I'm trying to make routine to parse my polynom but I didn't even start yet, because I don't understan exactly what I need to do....

I need to save some polynom into array and then for example with CASE command, look for variables, operators, e.g. in array, but what to do with them?? If I have X^2 +3x+5y, when I find + I need to separate them and save them into the new arrays??

Please, if there is someone who can help me with this... I don't understand the concept...

Thank you in advance!

------------------------------------------------

Hello.

I have some homework to do. I need to make program that finds minimum/maximum of a function od 2 variables in Fortran. I'm thinking of just do it for a polynom.

For start, I'm researching online, what's the best way.

I imagine it this way:

1. input the polynom and parse it

2. every parsed particle, derivate by the rule

3. partial derivativy by x and y must be ==0

4.solve set of equations

5. get values

6. for every (x,y) which may be minimum or maximum, calculate 2.derivative

7.make Hessian matrix

8. calculate det(H) and then look for first particle in Hessian

9.according to 8), decide if the T(x,y) is minimum, maximum or neither.

The thing that bothers me mostly is 1) and 2). As far as I know, it's very difficult to make symbolic derivative in Fortran, it's much easier to do automatic derivative(in exact point of x and y)

So, at the moment I'm trying to make routine to parse my polynom but I didn't even start yet, because I don't understan exactly what I need to do....

I need to save some polynom into array and then for example with CASE command, look for variables, operators, e.g. in array, but what to do with them?? If I have X^2 +3x+5y, when I find + I need to separate them and save them into the new arrays??

Please, if there is someone who can help me with this... I don't understand the concept...

Thank you in advance!

Last edited by a moderator: