Re: strange error
- To: mathgroup at smc.vnet.net
- Subject: [mg122266] Re: strange error
- From: Heike Gramberg <heike.gramberg at gmail.com>
- Date: Sun, 23 Oct 2011 06:21:47 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201110221009.GAA29789@smc.vnet.net>
You could use PieceWise instead of an If construction to define your function. For example test[m_] := Piecewise[{{2 m, m < 100}, {200 + 1 (m - 100), 100 <= m < 200}, {300 + .5 (m - 200), m >= 200}}] FindRoot[test[m] == 250, {m, 0}] returns {m -> 150.} Heike On 22 Oct 2011, at 12:09, Klemen Dovrtel wrote: > Hello everybody, > > I defined a simple function that is composed of three functions, each for different range of argument/variable. The function was composed using If[] conditions. The problem is that i can't FindRoot of this composed function. I get an error "the function value is not a list of numbers with dimensions {1}", which is not true. Any idea how can i solve this? > > > Mathematica print screen: > > http://www.shrani.si/f/t/vo/3jLzgMiy/prtscr.jpg > > Best Regards > Klemen
- References:
- strange error
- From: Klemen Dovrtel <klemen_dovrtel@yahoo.com>
- strange error