2 Jul 2011 02:12

## How can I add simplification rule depending relation between two factors?

```Hi,

I am trying to make simplification rules for divisor function divsum.

1. divsum(p^n) = (p^(n+1)-1)/(p-1) when p is prime.
defrule was great to implement this rule though I was happier if there is a feature of "prime".

(example)
matchdeclare(pp, primep, nn, lambda([x], (integerp(x) or featurep(x, integer)) and x > 0))\$
defrule(sigma_simp1, divsum(pp^nn, 1), (pp^(nn + 1) - 1)/(pp - 1))\$

declare(n, integer)\$
assume(n > 0)\$
sigma_simp1(divsum(3^n));
=> (3^(n+1)-1)/2

2. divsum(a*b) = divsum(a)*divsum(b) if a and b are relatively prime.

I lost my way for this simplification.
Are there any manners to let Maxima check if two variables are relatively prime?

Thanks,
-
Yuji
```
2 Jul 2011 02:18

### Re: How can I add simplification rule depending relation between two factors?

```On 7/1/2011 5:12 PM, ICHIKAWA, Yuji wrote:
> Hi,
>
> I am trying to make simplification rules for divisor function divsum.
>
> 1. divsum(p^n) = (p^(n+1)-1)/(p-1) when p is prime.
> defrule was great to implement this rule though I was happier if there is a feature of "prime".
>
> (example)
> matchdeclare(pp, primep, nn, lambda([x], (integerp(x) or featurep(x, integer)) and x>  0))\$
> defrule(sigma_simp1, divsum(pp^nn, 1), (pp^(nn + 1) - 1)/(pp - 1))\$
>
> declare(n, integer)\$
> assume(n>  0)\$
> sigma_simp1(divsum(3^n));
> =>  (3^(n+1)-1)/2
>
> 2. divsum(a*b) = divsum(a)*divsum(b) if a and b are relatively prime.
>
> I lost my way for this simplification.
> Are there any manners to let Maxima check if two variables are relatively prime?
>
> Thanks,
> -
> Yuji
> _______________________________________________
> Maxima mailing list
> Maxima <at> math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
a.   gcd(R,S) will be 1  if R and S are relatively prime.
```

2 Jul 2011 03:54

### Re: How can I add simplification rule depending relation between two factors?

```Fateman-san,

I recognized that there is no reliable way to attach a condition for matching that involves 2 parameters in
the match.

By the way, you can see a^b even if a, b are numbers, when you use a returned value of "factor".
It works well in the first case, though you need to change divsum to noun in order to see the result.
I think that the case of a*b is same.

Thanks,
-
Yuji

On 2011/07/02, at 9:18, Richard Fateman wrote:

> On 7/1/2011 5:12 PM, ICHIKAWA, Yuji wrote:
>> Hi,
>>
>> I am trying to make simplification rules for divisor function divsum.
>>
>> 1. divsum(p^n) = (p^(n+1)-1)/(p-1) when p is prime.
>> defrule was great to implement this rule though I was happier if there is a feature of "prime".
>>
>> (example)
>> matchdeclare(pp, primep, nn, lambda([x], (integerp(x) or featurep(x, integer)) and x>  0))\$
>> defrule(sigma_simp1, divsum(pp^nn, 1), (pp^(nn + 1) - 1)/(pp - 1))\$
>>
>> declare(n, integer)\$
>> assume(n>  0)\$
```

5 Jul 2011 02:21

### simplification function for divsum

```Hi,

I made a simplication function for divsum.
It works when second argument of divsum is 1.
I hope that someone will enjoy it.

Thanks,
-
Yuji

```
```
On 2011/07/02, at 10:54, ICHIKAWA, Yuji wrote:

> Fateman-san,
>
> I recognized that there is no reliable way to attach a condition for matching that involves 2 parameters in
the match.
>
> By the way, you can see a^b even if a, b are numbers, when you use a returned value of "factor".
> It works well in the first case, though you need to change divsum to noun in order to see the result.
> I think that the case of a*b is same.
>
> Thanks,
> -
> Yuji
```