piecewise cmd

Messages in english

Modérateur : xcasadmin

compsystems
Messages : 554
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

piecewise cmd

Message par compsystems » lun. févr. 17, 2020 1:39 pm

Hello
F0( X ) := piecewise( X < -2,-X,-2 ≤ X < 0, X + 1, 0 ≤ X < 2, X - 1, X ≥ 2, X^2 );
plotfunc( F0(X), X ) [enter] ok
F0( 2 ) [enter] 4

F7 := (X)->( (X<-2)? -X: ( ((-2≤X) AND (X<0))? X+1: ( ((0≤X) AND (X<2))? X-1 : ((X≥2)? X^2: X^2) ) ) ); [enter] ok
plotfunc( F7(X), X ) [enter] ok
F7( 2 ) [enter] 4

F9( X ) := piecewise( X < -2, -X, X < 0 AND X >= -2, X + 1, X < 2 AND X >= 0, X - 1, X > 2, X^2 );
plotfunc( F9(X), X ) [enter] ok
F9( 2 ) [enter] "No case applies" Why?

parisse
Messages : 5731
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: piecewise cmd

Message par parisse » lun. févr. 17, 2020 4:20 pm

compsystems a écrit :
lun. févr. 17, 2020 1:39 pm
F9( X ) := piecewise( X < -2, -X, X < 0 AND X >= -2, X + 1, X < 2 AND X >= 0, X - 1, X > 2, X^2 );
plotfunc( F9(X), X ) [enter] ok
F9( 2 ) [enter] "No case applies" Why?
Re-read your conditions, F9(2) is indeed not defined.

Répondre