itc
itc

Reputation: 175

Differentiating a piecewise function

I am trying to differentiate the piecewise function shown in the picture below using Maple
enter image description here

However when I assign the piecewise function to H using the following code

H := piecewise(gamma <> 0, exp(-(1 + gamma*(x - alpha)/beta)^(-1/gamma)), gamma = 0, exp(-exp(-(x - alpha)/beta)))

the function when γ=0 is being ignored and I am not sure why. I am getting the following output
enter image description here
As a result, when I try to find the derivative with respect to x, the derivative when γ=0 is omitted. I am kindly seeking assistance on how to resolve this problem.

Upvotes: 1

Views: 90

Answers (1)

acer
acer

Reputation: 7271

The name gamma is a predefined constant in Maple.

evalf(gamma);

        0.5772156649

You could first declare is local at the top-level, or you could use another name.

For example,

restart;
local gamma;

H := piecewise(gamma <> 0,
               exp(-(1 + gamma*(x - alpha)/beta)^(-1/gamma)),
               gamma = 0,
               exp(-exp(-(x - alpha)/beta)));

Upvotes: 1

Related Questions