ti-nspire

Simple range and domain function on ti-nspire cx cas not working


I am trying to code a simple function in the program editior of ti nspire cas cx.

Define LibPub transsolabcd()=
Prgm
:Request "Enter original expression: ",expr1,0
:Request "Enter mapped expression: ",expr2,0
:Request "Enter respect var: ",xvar,0
:Local a,b,c,d
:Define exprf1(xvar)=Func
:  Return expr1
:EndFunc
:Define exprf2(xvar)=Func
:  Return expr2
:EndFunc
:Disp (exprf1(2))
:EndPrgm

Disp (exprf1(2)) - This line here does not substitute for the value entered into the function, instead returns the entire function that was requested earlier. What I am doing wrong here?


Solution

  • Try this (assuming xvar is x):

    Define LibPub transsolabcd()=
    Prgm
    :Request "Enter original expression: ",expr1,0
    :Request "Enter mapped expression: ",expr2,0
    :Request "Enter respect var: ",xvar,0
    :Local a,b,c,d
    :Define exprf1(xvar)=Func
    :  Return expr1|x=xvar
    :EndFunc
    :Define exprf2(xvar)=Func
    :  Return expr2|x=xvar
    :EndFunc
    :Disp (exprf1(2))
    :EndPrgm
    

    The part I added, |x=xvar, substitutes x with the value of xvar, which is 2 in your function call.