Ask Your Question

Recursive max_symbolic???

asked 2012-04-24 15:25:47 +0200

sagemb gravatar image


Over a (x,y) space, I have n functions resp f_1(x,y), f_2(x,y), ..., f_n(x,y) and I would like to create g(x,y) =max(f_1(x,y), f_2(x,y), ..., f_n(x,y), constant)

I now know it is possible to use max_symbolic with 2 functions, but then if I have say 100 of them, it gets clumpsy.

Does anyone know a way to do that?


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-04-24 16:05:43 +0200

kcrisman gravatar image

Maybe with a list comprehension?

sage: var('y')
sage: max_symbolic([sin(2*k*x*y) for k in [0..100]])
max(0, sin(2*x*y), sin(4*x*y), sin(6*x*y), sin(8*x*y), sin(10*x*y), sin(12*x*y), sin(14*x*y), sin(16*x*y), sin(18*x*y), sin(20*x*y), sin(22*x*y), sin(24*x*y), sin(26*x*y), sin(28*x*y), sin(30*x*y), sin(32*x*y), sin(34*x*y), sin(36*x*y), sin(38*x*y), sin(40*x*y), sin(42*x*y), sin(44*x*y), sin(46*x*y), sin(48*x*y), sin(50*x*y), sin(52*x*y), sin(54*x*y), sin(56*x*y), sin(58*x*y), sin(60*x*y), sin(62*x*y), sin(64*x*y), sin(66*x*y), sin(68*x*y), sin(70*x*y), sin(72*x*y), sin(74*x*y), sin(76*x*y), sin(78*x*y), sin(80*x*y), sin(82*x*y), sin(84*x*y), sin(86*x*y), sin(88*x*y), sin(90*x*y), sin(92*x*y), sin(94*x*y), sin(96*x*y), sin(98*x*y), sin(100*x*y), sin(102*x*y), sin(104*x*y), sin(106*x*y), sin(108*x*y), sin(110*x*y), sin(112*x*y), sin(114*x*y), sin(116*x*y), sin(118*x*y), sin(120*x*y), sin(122*x*y), sin(124*x*y), sin(126*x*y), sin(128*x*y), sin(130*x*y), sin(132*x*y), sin(134*x*y), sin(136*x*y), sin(138*x*y), sin(140*x*y), sin(142*x*y), sin(144*x*y), sin(146*x*y), sin(148*x*y), sin(150*x*y), sin(152*x*y), sin(154*x*y), sin(156*x*y), sin(158*x*y), sin(160*x*y), sin(162*x*y), sin(164*x*y), sin(166*x*y), sin(168*x*y), sin(170*x*y), sin(172*x*y), sin(174*x*y), sin(176*x*y), sin(178*x*y), sin(180*x*y), sin(182*x*y), sin(184*x*y), sin(186*x*y), sin(188*x*y), sin(190*x*y), sin(192*x*y), sin(194*x*y), sin(196*x*y), sin(198*x*y), sin(200*x*y))
sage: plot3d(_,(x,-3,3),(y,-3,3))
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


Asked: 2012-04-24 15:25:47 +0200

Seen: 437 times

Last updated: Apr 24 '12