Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: [Newbie] Interpreting output

  • To: mathgroup at smc.vnet.net
  • Subject: [mg56658] Re: [Newbie] Interpreting output
  • From: Peter Pein <petsie at arcor.de>
  • Date: Mon, 2 May 2005 01:32:40 -0400 (EDT)
  • References: <d51nl8$cu9$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

MC wrote:
> Hi everybody....
> 
> I'm having troubles in interpreting the output of Mathematica.
> 
> My problem is to define a function F(x,y,z) such that:
> F = (whatever) if x>c
> F=(whatever) if x<=c
> 
> I achievied this using /;
> 
> When I derive F with respect to one of the variables, the result is a mess.
> Just an example with 1 variable:
> 
> f=x/;x>0;
> f=-x^2/;x<0;
> 
This is not a function.

> D[f,x]=-2Condition(1,0)[x^2,x<0]+Condition(1,0)[x^2,x<0]Less(1,0)[x,0]
> 
> Even in this very simple case, the result is a real mess:
> I really do not know how should I read that...and I'm wondering if
> I have defined the function in the right way.
> 
> Anybody so kind to explain me what's goung on?
> 
> Thank you very much for your patience
> 
If you want a function:
In[1]:= f[x_]:=Piecewise[{{x,x>0},{-x^2,x<0}},0];
        f'[x]//InputForm
Out[2]//InputForm=
Piecewise[{{-2*x, x < 0}, {1, x > 0}}, Indeterminate]

looks nice without InputForm.

Piecewise is new in version 5.1. For older versions:

In[3]:= f4[x_]:=Which[x<0,-x^2,x>0,x];
        f4'[x]
Out[4]= Which[x<0,-2 x,x>0,1]
-- 
Peter Pein
Berlin


  • Prev by Date: Re: is this solvable?
  • Next by Date: Re: books on writing packages
  • Previous by thread: Re: [Newbie] Interpreting output
  • Next by thread: Re: Not getting numeric answer to simple division