Ask Your Question
1

max unevaled in plot??

asked 3 years ago

updated 3 years ago

slelievre gravatar image

Dear all,

Here is a puzzling code:

var('a')
show(plot(max([1-a, a]), (a,0,1)))
show(plot(max([a, 1-a]), (a,0,1)))

Only the first term of the list is used in this maximum!???

Any hint is welcome, I can sure plot a polygon made of sample points, this works, but I would rather understand why the above simple piece fails to behave as I would expect.

Many thanks in advance! Olivier

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 3 years ago

updated 3 years ago

slelievre gravatar image

Sorry for the noise, I'm seeing the light -- I should have written

def ff(b):
    return(max([b, 1-b]))

show(plot(ff, (a, 0, 1)))

The other writing mixes symbolic rules with pure code.

Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 3 years ago

Seen: 190 times

Last updated: Feb 07 '22