HP Forums
single_inter does not find intersection - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: single_inter does not find intersection (/thread-2196.html)



single_inter does not find intersection - kickniko - 09-28-2014 10:33 AM

Hi all!

Working with the Geo App on graphically estimating working points, voltages, gains and the like for a tube shortwave HF-Amp. (BTW, great App that tends to become one of my all time favorites - thanks a lot guys!)

I defined some plotfunc's of the form plotfunc(a*ln(x)+b). Examples:
GB plotfunc(1.301*ln(x)+3.406
GC plotfunc(0.9718*ln(x)+2.524

These functions get plotted without any problems.

Then I defined a point:
GE point(40,0)
It also gets plotted fine.

Then an element of GC as:
GG element(GC,20)
Goes well too.

Then the line through GE and GG as:
GH line(GE,GG)
Everything fine yet.

Now I try to find the intersection of GH with GB using:
GI single_inter(GH,GB)
The App cannot find that point. (It does not work using single_inter(GH,GB,GG) or single_inter(GH,GB,GE) either.)

But the CAS can readily nsolve this and get the x-coordinate of the intersection.

So, what is going on? Any suggestions?

Bye,

Nick


RE: single_inter does not find intersection - akmon - 09-29-2014 06:28 AM

You´re right. I followed your steps, and I could not get the intersection point.

By the way, how did you find the solution with nsolve command?. I tried to insert the line ecuation and the LN one, like nsolve([y=-0,2717*x+10,87 y=1,301*LN(x)+3,406],[x,y]) and the sandclock works without answer. I had to soft reset. I used fsolve instead and it worked ok. Something does not work well in this case. Bug?

By the way: where is the fsolve command in the CAS tool boxes? I cannot find it!.


RE: single_inter does not find intersection - parisse - 09-29-2014 06:34 AM

There is indeed a bug. Will be fixed in Xcas (unstable) this week.


RE: single_inter does not find intersection - kickniko - 09-29-2014 07:39 AM

(09-29-2014 06:28 AM)akmon Wrote:  You´re right. I followed your steps, and I could not get the intersection point.

By the way, how did you find the solution with nsolve command?. I tried to insert the line ecuation and the LN one, like nsolve([y=-0,2717*x+10,87 y=1,301*LN(x)+3,406],[x,y]) and the sandclock works without answer. I had to soft reset. I used fsolve instead and it worked ok. Something does not work well in this case. Bug?

By the way: where is the fsolve command in the CAS tool boxes? I cannot find it!.

Hi!

I just nsolved for x, not for x and y. For example:

nsolve(1,301*LN(x)+3,406-(-0,2717*x+10,87) , x )

which immediately delivers 14.6254232747.

Substituting this value back to either 1,301*LN(x)+3,406 or -0,2717*x+10,87 will give you the y value of 6.89627249626.

Ciao,

Nick


RE: single_inter does not find intersection - kickniko - 09-29-2014 07:54 AM

(09-29-2014 06:34 AM)parisse Wrote:  There is indeed a bug. Will be fixed in Xcas (unstable) this week.

OK.

BTW, you mean a bug in single_inter, may I assume? (Or in nsolve, as akmon asked?)

Anyway, I replaced the LN functions with ATAN functions (with different sets of fitted parameters), since I just needed more or less good approximations of measurement series. With ATAN the intersections could be found, and all related calculations could be traced perfectly. (And so at last I know now, why that %&*$-HF-Amp turnes to a HF.. attenuator over 50 MHz. :-))

Thanks and ciao,

Nick


RE: single_inter does not find intersection - parisse - 09-29-2014 08:04 AM

There were 2 problems: one with ln(x) which was replaced by ln(abs(x))+i*arg(x) leading to problems since ln(x) was multiplied by i in the plot parametric equation, another one with mixing exact and numeric data in simplify.
Using atan is safer since it is defined from R to R.


RE: single_inter does not find intersection - kickniko - 09-29-2014 09:56 AM

(09-29-2014 08:04 AM)parisse Wrote:  There were 2 problems: one with ln(x) which was replaced by ln(abs(x))+i*arg(x) leading to problems since ln(x) was multiplied by i in the plot parametric equation, another one with mixing exact and numeric data in simplify.
Using atan is safer since it is defined from R to R.

I understand - thank you very much!

Ciao,

Nick