Strange behavior of HP prime pro app
|
11-15-2020, 08:11 AM
Post: #1
|
|||
|
|||
Strange behavior of HP prime pro app
Hi everybody,
I wrote a little program that computes the mean EZ and standard deviation SZ of the ratio of two normal distributed variables X and Y with means X1 and Y1, correlation R and standard deviations 1. The program is like this: EXPORT RATIO() BEGIN LOCAL X1,Y1,R,FL,EZ,SZ,X,Y; INPUT(X1,"MUE1=?"); INPUT(Y1,"MUE2=?"); INPUT(R,"CORR=?"); ∫(√((1+Y^2)/(1+R^2))/2/π*∫(e^(−((X-X1)^2+(Y*X-Y1)^2-2*R*(X-X1)*(Y*X-Y1))/(2*(1-R^2))),X,X1-6,X1+6),Y,Y1-6,Y1+6)▶FL; ∫(Y*√((1+Y^2)/(1+R^2))/2/π*∫(e^(−((X-X1)^2+(Y*X-Y1)^2-2*R*(X-X1)*(Y*X-Y1))/(2*(1-R^2))),X,X1-6,X1+6),Y,Y1-6,Y1+6)▶EZ; EZ/FL▶EZ; ∫(Y^2*√((1+Y^2)/(1+R^2))/2/π*∫(e^(−((X-X1)^2+(Y*X-Y1)^2-2*R*(X-X1)*(Y*X-Y1))/(2*(1-R^2))),X,X1-6,X1+6),Y,Y1-6,Y1+6)▶SZ; √(SZ/FL-EZ^2)▶SZ; PRINT("--------------------------------"); PRINT("MUE1=" +X1); PRINT("MUE2=" +Y1); PRINT("CORR=" +R); PRINT("FL=" +FL); PRINT("EZ=" +EZ); PRINT("SZ=" +SZ); END; It works both on HP prime G1 and G2 as expected. If I run it on the prime pro app for windows (Build 2.1.14527 (2020 6 24)) it let me put in X1, Y1 (both 4.), R (0.5), then it seems to compute and then the app is closed without any error message. I made a debug stepwise. It happens in the first line with an integral directly after the input of R. Does anybody know what to do about this? Thank you very much and best regards Raimund |
|||
11-15-2020, 04:21 PM
Post: #2
|
|||
|
|||
RE: Strange behavior of HP prime pro app
Try not using built in variable names declared as local. Like this:
EXPORT RATIO() BEGIN LOCAL exx1,why1,arr,FL,EZ,SZ,exx,why; INPUT(exx1,"MUE1=?"); INPUT(why1,"MUE2=?"); INPUT(arr,"CORR=?"); ∫(√((1+why^2)/(1+arr^2))/2/π*∫(e^(−((exx-exx1)^2+(why*exx-why1)^2-2*arr*(exx-exx1)*(why*exx-why1))/(2*(1-arr^2))),exx,exx1-6,exx1+6),why,why1-6,why1+6)▶FL; ∫(why*√((1+why^2)/(1+arr^2))/2/π*∫(e^(−((exx-exx1)^2+(why*exx-why1)^2-2*arr*(exx-exx1)*(why*exx-why1))/(2*(1-arr^2))),exx,exx1-6,exx1+6),why,why1-6,why1+6)▶EZ; EZ/FL▶EZ; ∫(why^2*√((1+why^2)/(1+arr^2))/2/π*∫(e^(−((exx-exx1)^2+(why*exx-why1)^2-2*arr*(exx-exx1)*(why*exx-why1))/(2*(1-arr^2))),exx,exx1-6,exx1+6),why,why1-6,why1+6)▶SZ; √(SZ/FL-EZ^2)▶SZ; PRINT("--------------------------------"); PRINT("MUE1=" +exx1); PRINT("MUE2=" +why1); PRINT("CORR=" +arr); PRINT("FL=" +FL); PRINT("EZ=" +EZ); PRINT("SZ=" +SZ); END; I can't test this on your exact platform but it works on the simulator for windows 10. -road |
|||
11-16-2020, 08:47 AM
Post: #3
|
|||
|
|||
RE: Strange behavior of HP prime pro app
Hi roadrunner,
thank you very much. I tried your code and unfortunately it did not work with my version of the Prime Pro PC software. Now it did not stop and closed the app but it went on and on. After 20 minutes I terminated the process. I tried as well your code on a Prime calculator. There it worked perfect and gave the right results in about 5 seconds. I tried in the app with a debug. It was again the line with the first double integral that caused the problem. When I replaced that line with a simple 0.5 ▶ FL; it was the second line with the double integral that cased the same problem. It seems to me that the app has a problem with double integrals the calculator does not have. Thanks again and best regards Raimund |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)