HP Forums
pointed bracket or singular function - 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: pointed bracket or singular function (/thread-2489.html)



pointed bracket or singular function - resolved - 11-25-2014 07:09 AM

in creating a function for that deflection of a beam requires, I am told, the use of pointed brackets or a singular function. If the term within the brackets < > evaluates less than zero, the term becomes zero, something like this

y = -5*x^3 + 180*<x-1>^2 - 10/12 * <x-2>^4 + 10/12*<x-4>^4 - 10*<x-5>^3 - 535*x

is there anyway to input this formula into the HP Prime where the terms in < > will drop out if they evaluation less than zero????


RE: pointed bracket or singular function - Han - 11-25-2014 01:24 PM

(11-25-2014 07:09 AM)resolved Wrote:  in creating a function for that deflection of a beam requires, I am told, the use of pointed brackets or a singular function. If the term within the brackets < > evaluates less than zero, the term becomes zero, something like this

y = -5*x^3 + 180*<x-1>^2 - 10/12 * <x-2>^4 + 10/12*<x-4>^4 - 10*<x-5>^3 - 535*x

is there anyway to input this formula into the HP Prime where the terms in < > will drop out if they evaluation less than zero????

Would a piecewise function fit your needs?
\[ f(x) = -5x^3 - 535x +
\begin{cases}
180(x-1)^2, & x \ge 1\\
0, & x<1
\end{cases}
+ \begin{cases}
-\frac{10}{12}(x-2)^4, & x \ge 2\\
0, & x < 2
\end{cases}
+ \begin{cases}
+\frac{10}{12}(x-4)^4, & x \ge 4\\
0, & x < 4
\end{cases}
+ \begin{cases}
-10(x-5)^3, & x\ge 5\\
0, & x<5
\end{cases}
\]
The piecewise functions can be created via the template key


RE: pointed bracket or singular function - Nigel (UK) - 11-25-2014 05:30 PM

(11-25-2014 07:09 AM)resolved Wrote:  in creating a function for that deflection of a beam requires, I am told, the use of pointed brackets or a singular function. If the term within the brackets < > evaluates less than zero, the term becomes zero, something like this

y = -5*x^3 + 180*<x-1>^2 - 10/12 * <x-2>^4 + 10/12*<x-4>^4 - 10*<x-5>^3 - 535*x

is there anyway to input this formula into the HP Prime where the terms in < > will drop out if they evaluation less than zero????

You can use the MAX (maximum) function (Math menu, Arithmetic) and type (for example) MAX(0,x-1).

Nigel (UK)


RE: pointed bracket or singular function - resolved - 11-26-2014 10:32 AM

thanks Han and Nigel, both worked, much better than my solution of creating five different equations in Solver to evaluate


RE: pointed bracket or singular function - Han - 12-01-2014 04:11 PM

(11-26-2014 10:32 AM)resolved Wrote:  thanks Han and Nigel, both worked, much better than my solution of creating five different equations in Solver to evaluate

Take care as they are not equivalent. For example, MAX((x-2)^2,0) is always the same as just (x-2)^2, whereas MAX((x-2)^3,0) is the same as
\[ f(x) = \begin{cases} (x-2)^3, & x\ge 3\\ 0, & x<3 \end{cases} \]

I'm not quite sure which it is you want, though your original post says that that if the expression inside the < > is negative, then entire term is 0. That is not the same thing as using the MAX() function. Thus <x-2>^2 should be 0 for x<2. However, MAX((x-2)^2,0) is positive if x<2.

Edit: I may have misinterpreted the posts. If you indeed meant what you originally wrote, then MAX(x-2,0)^2 (note the square on the outside) would work just fine.


RE: pointed bracket or singular function - resolved - 12-04-2014 10:45 AM

thanks Han for your thoughts, yes I wanted the pointed bracets evaluated before it is squared.