Message Boards Message Boards


How do I use correctly use curly brackets in wolfram for multi-functions?

Posted 8 years ago
4 Replies
3 Total Likes

Example, if I'm trying to find the limit x approaching 2 of f(x) and I have the following equation: (imagine the two curly brackets are just one big stretched one that holds everything)

f(x)= {2x+1 considering x<2

{x^2 considering x>2

How would I go about entering this in? This would be really helpful.

POSTED BY: Symond Hendricks
4 Replies

x_ means that x is an undetermined variable. You need to look at the Mathematica documentation

POSTED BY: S M Blinder

You can also use

f[x_] := Which[x < 2, 2 x + 1, x > 2, x^2]

although this leaves f[2] undefined

POSTED BY: S M Blinder

Can you elaborate? Your formula looks alot better than the messy piecewise code. I'd like to use it!

What do you mean by the _ in f[x_]? and when I write it out do I also write ":= Which"

What would be another random example (doesn't have to be a real equation) for say a piecewise function with THREE different functions?

POSTED BY: Symond Hendricks

Use Piecewise. The documentation center has examples and sample code.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract