Question: Help with an If statement for finite difference methods

Could somebody help me I am having trouble with an if statement.

I have defined three functions a.b and c in terms of one variable j.

I have correctly defined g_{k,j} as well as other functions and now I have run into trouble with my if statement.

p:=(k,j)->if k=0 then max(K-j*S,0) else g_{k,j} end if

I think its clear what i am trying to achieve in the if statement as I want to be able to enter p(1,4), p(4,3) etc. . .  after the if statement but the error is telling me that this is AN INVALID ARROW SEQUENCE

 

How do I fix it?

Please Wait...