Ask Your Question
1

max unevaled in plot??

asked 2022-02-06 23:57:58 +0200

updated 2022-02-07 00:32:56 +0200

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-02-07 00:11:37 +0200

updated 2022-02-07 00:33:17 +0200

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.

edit flag offensive delete link more

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: 2022-02-06 23:57:58 +0200

Seen: 104 times

Last updated: Feb 07 '22