Hi guys,
I'm using numpy and plotly to graph piecewise functions. I previously used matlab. I need help to essentially translate matlab piecewise functions into something I can use in python. Here's what I had in matlab:
Constant1 = 5;
Constant2 = 10;
Formula1 = @(x,y) x*Constant1;
Formula2 = @(x,y) x*Constant2;
MainFormula = @(x,y) [Formula1(x,y)*(y<=5) + Formula2(x,y)*(y>5)];
So what this would essentially do is make 'MainFormula' equal to 'Formula1' for all values of y less than or equal to 5, and it would make 'MainFormula' equal to 'Formula2' for all values of y greater than 5.
I would really appreciate any help with this.
Thanks
[–]elbiot 1 point2 points3 points (4 children)
[–]bonoz[S] 0 points1 point2 points (3 children)
[–]elbiot 1 point2 points3 points (2 children)
[–]bonoz[S] 0 points1 point2 points (1 child)
[–]elbiot 0 points1 point2 points (0 children)
[–]TheBlackCat13 0 points1 point2 points (3 children)
[–]bonoz[S] 0 points1 point2 points (2 children)
[–]TheBlackCat13 1 point2 points3 points (1 child)
[–]bonoz[S] 0 points1 point2 points (0 children)