Jacques Gélinas on Mon, 20 Jul 2020 03:39:46 +0200
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Feature suggestion: "ifcmp" convenience control statement
|
- To: "pari-users@pari.math.u-bordeaux.fr" <pari-users@pari.math.u-bordeaux.fr>
- Subject: Re: Feature suggestion: "ifcmp" convenience control statement
- From: Jacques Gélinas <jacquesg00@hotmail.com>
- Date: Mon, 20 Jul 2020 01:39:41 +0000
- Accept-language: fr-CA, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Cj0Dk73DyXlO6cxMdGUFfFdKbqtND1B0fljhKyQ6ZVg=; b=f9S5yYR7vFG77gelY7nORM9JxRaVIIO/0+qnmnEozT6GPOcz4vsHuJTjY26Ur7VKiwRkGFoK2qXN4bVdl5MeTqzCvJuYzjDXIgyRB838hsSxEtebdduRFEgFgG9vvbrIhrm+kVJ3Fd7z8fbmVdgFri04o0zu2qsSebtrZ4wANFHZynNyWROMIUMQiXquBGiJTragNoZZpDCs0ZvALltVUJLEGp+qEW3f/OVEwnnAfWk/WfsHM1wFEeFBH0G6DSuYHh6NfiUWuh+DTK4E0OAsnxq5emAgT/Fh53nqLUMg8cWea7Oa6FXlGj88q+fVX7tDAnsIq1B9mo9n2hrRR84s/A==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xq9AiTP4IgQLrfdbvHysM+LxTrwf5i29o5/van3KXaCqvGzOj8AnXyqe0ulMF4ONPf+nubmiEyUDnhrfVVEYtyurIezNMWq0ueHkxPxzy2bVODZWOPKQxz4m3pEINFOMefRWfys/pmNTIZWpqt54GJIAcSn53qC850/wNhgFD6LFca1Ckto2pLeJXsA6eebqOw4LCBtRU2SrW/o3Mi5IzPOmVv1qfnpSrgPGQOwFDv6Tu0sR01rT3QzGJ2U/1Y1ylmlASNv/PRzpvZyY1E/USnOXkoY1OT0RVPMk3YLyjQ5b/4rPwmG3SGOEdeUcV+dhCE4ZcCSoPRmRgHoA+bH0oA==
- Delivery-date: Mon, 20 Jul 2020 03:39:46 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Cj0Dk73DyXlO6cxMdGUFfFdKbqtND1B0fljhKyQ6ZVg=; b=qU5B9I0D3GUuE3Wecf0FCwVDr1uVHR2kRM2uxtB+ruAcUmx9IFT8fCgWXLi1Ao83Jzd+cwPATdTOcd47YxjMggHpum5Ot7EwdDcqwskT/p8hgX3ofBVBVjdTJkAowBCTUewhcbVthyFj794JV9PGbCQjyrtFvEBQKHxJWNqK94WraovVETkaFQyLmrlerQxPYyPR1tNbI/1Af1TOoU0o9FU/mUkt38ig2KFGuvqBwXR/iGRtCaMBVxvkvLHZzt7Xihfb2EqVBjdWmuxwu87h0mcyN/tkXUsYDgrDX9O1N7GBk1Epkm6O71nn8RUWLWbnbgLWUMQ5HJMduQM68Y8MMA==
- In-reply-to: <20200719212426.GD16935@yellowpig>
- References: <CAFoRp-P69PGgsbqrSOnv0XmJXo3g6BEXK7st1pf4VhxMQg1xxg@mail.gmail.com>,<20200719212426.GD16935@yellowpig>
- Thread-index: AQHWXg+57rFJeyvAG0uYInEtg6wDhqkPadUAgABDu+U=
- Thread-topic: Feature suggestion: "ifcmp" convenience control statement
Sometimes, I use many comparisons like this polynomial coefficient
depending on global variables
$ ak(k=0,d='d)={ if(
BESS==1,1/prod(j=1,k,1+d/(2*j-1)),
MIKE==1,1/prod(j=1,k-1,prod(i=1,j,1+d/(2*i+1))),
MIK==1,prod(j=1,k,prod(i=1,j,(2*i-1)/(d+2*i-1))),
RK==1,prod(j=1,k,(2*j-1)*rks(j)^(k-j)),
AKX==1,akx(k,d),
eval(Str("a"k)));} \\ general case
Jacques Gélinas
De : Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
Envoyé : 19 juillet 2020 17:24
À : pari-users@pari.math.u-bordeaux.fr <pari-users@pari.math.u-bordeaux.fr>
Objet : Re: Feature suggestion: "ifcmp" convenience control statement
On Sun, Jul 19, 2020 at 04:00:23PM -0500, Hans L wrote:
> When writing functions in gp, I think it is fairly common to need to
> do 3 different things depending on a comparison of two values.
> This can of course be done with nested if() but it feels verbose and
> can get messy depending on how complicated the terms are:
> if(a<b, do_lt(), if(a>b, do_gt(), do_eq() ))
You can do
if(a<b, do_lt(), a>b, do_gt(), do_eq())
Cheers,
Bill.