Post Reply 
Solver
10-11-2015, 03:54 PM
Post: #1
Solver
Hi,

I have wrote a function inside my program.
Code:

EXPORT TEST(x)
BEGIN
  RETURN ..........CODE..............
END;
Now I would solved this function for a value like this

TEST(x)-0,5=0

Is this posible to do this inside my program?

Wich solver do I use? (My function is not linear)

Is it also posible to give the error for stopping the solver?

Cheers,

Jan
Find all posts by this user
Quote this message in a reply
10-12-2015, 05:43 AM
Post: #2
RE: Solver
Hello,

The following will work.
Please note that FNC must be either EXPORTED, or you must fully qualify it in the call to Solve.SOLVE.

EXPORT FNC(A)
BEGIN
return COS(A);
END;

EXPORT test()
BEGIN
Solve.SOLVE(FNC(X),X);
END;

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
10-12-2015, 07:16 AM
Post: #3
RE: Solver
Cyrille,

Thanks for the response.
But I won't to use the solver to search between boundaries.

(Like a binary search)

Is that posible?

Cheers,

Jan
Find all posts by this user
Quote this message in a reply
10-12-2015, 03:13 PM
Post: #4
RE: Solver
Hello,

The solver can be given 1 or 2 guesses to get started, HOWEVER, it does NOT (as a general rule) do a binary search, it uses 3 types of methods:
Quadratic, hyperbolic and Newton, basically, it tries first to ascertain what the function looks like and then pick one of the 3 methods to try to zero on the solution.
When it feels that it is very close, then it uses dichotomy search.

The net result is that there is no guaranties that the zero found (if the function has more than 1) will be close to the provided guesses (although it generally is).

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
10-12-2015, 03:21 PM
Post: #5
RE: Solver
Cyrille

Please can you help me with the syntax.

My Function name id SunPos, and I won't found a zero between
5763.9 <= x <= 5764.9.

Try to find an example but could notting found!

Thanks,

Jan
Find all posts by this user
Quote this message in a reply
10-13-2015, 05:18 AM
Post: #6
RE: Solver
hello,

Can you post your program? or at least the function code?

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
10-13-2015, 05:49 AM
Post: #7
RE: Solver
Hi,

This is my function code;

Code:

F(t)
BEGIN
//--------------------------------------------
//Sunposition gives the Azimuth back
//Sove SunPosition(t)-0.8=0
//--------------------------------------------
RETURN SunPosition(t)-0.8;
END;


Thanks for any help.

Regards.
Find all posts by this user
Quote this message in a reply
10-14-2015, 05:45 AM
Post: #8
RE: Solver
Hello,

As I said in my first posting:
>Please note that [the evaluation function] must be either EXPORTED, or you must fully qualify it in the call to Solve.SOLVE.

so, if you EXPORT F, you should be able to do:

Solve.SOLVE(F(X),X);

However, I would suggest that you rename it to something else than F in order to avoid any possible funny business with the build in F variable.

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)