Piecewise TF1 through parameter switch

Consider a function object like TF1(“myFunctionName”, “([0]*3 - 5)*x”, -1, 1), where [0] has the following rule:
[0] = 1 if x<0. Otherwise, [0]=1. (The function will appear piecewise)

How would I build a function with this property? The parameter should change value conditionally with x.

Consider doing something like the case 3 on this page.

Hi Couet, do you mean the lambda function example?

Case 3: inline expression using a user defined CLING function by name

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.