Inquiry Equation on Symbolic and Numeric View - Printable Version +- HP Forums ( https://www.hpmuseum.org/forum)+-- Forum: HP Calculators (and very old HP Computers) ( /forum-3.html)+--- Forum: HP Prime ( /forum-5.html)+--- Thread: Inquiry Equation on Symbolic and Numeric View ( /thread-18472.html) |

Inquiry Equation on Symbolic and Numeric View - wmundstock - 06-15-2022 11:13 AM
Hi All. I wrote a small program to record my favorite electronics equations and formulas and fill in the E1-E0. For completenes there is a simple equation for the OPAmps that is like this: [attachment=10806] So if V1 is greater than V2 then Vout = V+. I know how to do this with programming using IF statements, but I wanted to reproduce this in one of the E1-E9 variables. Is this possible? I know its a very simple equation but I really wanted to have it there for completeness. Thank you! RE: Inquiry Equation on Symbolic and Numeric View - roadrunner - 06-15-2022 01:54 PM
I think you might be looking for the PIECEWISE function: Syntax: PIECEWISE(test1, case1, ...[, test8], case8) Used with Home settings Entry set to Algebraic to enter a piecewise-defined function in the Function app Symbolic view (among other uses). Takes as arguments pairs, each of which consists of a condition that defines a sub-function domain and an expression that defines the sub-function. Each of these pairs defines a sub-function of the piecewise function and the domain over which it is active. If used with Home settings Entry set to Textbook or if accessed via the Template menu, then the syntax varies slightly and is restricted to two pieces. Syntax : {case1 if test1 … {case8 [if test8] Example: PIECEWISE(X<-4,X,-4≤X AND X<2, X+1, X≥2,X+2) as F1(X) in the Symbolic view of the Function app appears as: X if X<-4 F1(X)= X+1 if -4≤X AND X<2 X+2 if X≥2 In Plot view, the graph of two rays and a segment is drawn. RE: Inquiry Equation on Symbolic and Numeric View - Didier Lachieze - 06-15-2022 02:20 PM
(06-15-2022 11:13 AM)wmundstock Wrote: So if V1 is greater than V2 then Vout = V+. First I don't think you can have variable names with + or - inside. Then you need to first create the different variables you're using in the equation if they are not predefined. This being said you can write the equation this way: Vout=IFTE(V1>V2,Vsp,Vsm) which means: IF V1>V2 THEN Vout=Vsp ELSE Vout=Vsm where Vsp stands for Vs+ and Vsm for Vs-. |