cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

solve block/ function

payman
13-Aquamarine

solve block/ function

Hello All.

Within my program, there is a solve block that finds some parameters with given guess values. For repeating the calculations, the guess values must be changed according to the new set of inputs.

Is there any way to define a local function that automatically change the guess values and use this local function inside the main body of my program?

the attached file contains the solve block that I need to express as a local function.

thank you in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
AndyWesterman
4-Participant
(To:payman)

attached shows a simple way to use the function within a program loop,

Hope it helps

any questions , please let me know

Regards

Andy

View solution in original post

4 REPLIES 4

May by so:

f(r1, r2, r3, n0, n1, n2, n3):=Find(...

MikeArmstrong
5-Regular Member
(To:payman)

You cannot use a solve block within a program. However you may be able to use a 'while loop'.

Werner_E
24-Ruby V
(To:payman)

PAYMAN RAJAI wrote:

Hello All.

Within my program, there is a solve block that finds some parameters with given guess values. For repeating the calculations, the guess values must be changed according to the new set of inputs.

Is there any way to define a local function that automatically change the guess values and use this local function inside the main body of my program?

the attached file contains the solve block that I need to express as a local function.

Don't use a vector index 0 for n0 unless you really want n0 to be a 1x1 vector.

You have already turned the solve block into a function of r1,r2,r3. Why not simply add n0 to the argument list?

You call n0 a (variable) guess value, but you dont use n0 when you call Find. So n0 is not a variable you want to solve for but, like r1..r3 just a constant.

If you would use n0 additionally in Find you would run into troubles as you would have four variables to solve for but just three equations.

So what is it you really are after?

AndyWesterman
4-Participant
(To:payman)

attached shows a simple way to use the function within a program loop,

Hope it helps

any questions , please let me know

Regards

Andy

Top Tags