Quantcast
Channel: Cemetech
Viewing all articles
Browse latest Browse all 75829

TI-BASIC :: RE: Max of Y1

$
0
0
Author: Travis
Posted: 24 Mar 2013 06:37:05 pm (GMT -5)

Here's what I found going through:


Code:
Lbl z0
ClrHome :ClrDraw
InputStr "Y1(X):",y: expr("Define Y1(x)="&y)
expr("Define y2(x)="&string(d(y1(x),x,3)))
expr("Define y3(x)="&string(fMax(y2(x),x)))


Looks like we're getting bit by the way symbolic expressions are handled—in the default Approx setting of “AUTO”, it's wanting to store “x=∞ or x=∞ or x=@n1*π” into y3. Unfortunately, extracting the formula @n1*π (which means any integer times pi) is non-trivial—there are some basic expression parsing functions available, but you'd have to code some way to recognize which one is the function—and then what if there is more than one returned?

But, if you're just looking for a simple approximate decimal value instead, by forcing approx mode like this:


Code:
expr("Define y3(x)="&string(approx(fMax(y2(x),x))))



Code:
y3(x)→k
Prompt b,a,n
k(b-a)^3/(12*n^2)→e


The k(b-a) is getting interpreted as a function call, but k is not defined as a function (hence the error message). If you want multiplication, just insert a * to make it unambiguous:


Code:
k*(b-a)^3/(12*n^2)→e


On the other hand, if you're trying to get a formula from fMax( and plug b-a into it, that's going to be a bit of a problem due to what I mentioned above.


Code:

Disp "E=",e
Disp exact(e)
Pause

_________________


Viewing all articles
Browse latest Browse all 75829

Latest Images

Trending Articles



Latest Images