Subject: Re: bug#62658: [Typo] in Calc-Manual: Rewrite Rules - exercise 1
From: Eli Zaretskii <[email-masked]>
To: Garid Zorigoo <[email-masked]>
Cc: [email-masked]
Date: Sat, 08 Apr 2023 19:15:20 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Garid Zorigoo <[email-masked]>
> Date: Fri, 7 Apr 2023 21:46:21 +0900
> Cc: [email-masked]
> 
> > It's possible.  But I tried to run the example, and I seem to be
> > unable to get past the formula I'm asked to enter after the "m s"
> > part: I get error messages.
> 
> Sorry, which "m s" are you referring to?
> The section I referred to (from the start of "3.5.2 Rewrite Rules" to
> first 2 entries of "Exercise 1") didn't have the command "m s".
> 
> > Could you perhaps show the commands and keys to type
> 
> To reproduce it'll need the following commands (in emacs -Q).
> (These are copied from Rewrite-Rules 3.5.2 (in emacs-28)
> or 2.5.2 (website). I picked up only entries /omitted outputs/)
> 
> 
>     ' 2sec(x)^2/tan(x)^2 - 2/tan(x)^2 <RET>   s 1
>     a r a/x + b/x := (a+b)/x <RET>
>     a r sec(x)^2 := 1 + tan(x)^2 <RET>
> 
> 
>     ' a/x + b/x := (a+b)/x <RET>          s t merge <RET>
>     ' sec(x)^2 := 1 + tan(x)^2 <RET>      s t secsqr <RET>
>     r 1                  a r merge <RET>  a r secsqr <RET>
> 
> 
>     ' [merge,sinsqr] <RET>          =
>     s t trig <RET>  r 1                  a r trig <RET>
> 
> 
> According to the manual, the output after the last line should be 2.
> 
> I wrote the following tables, slightly detailed manner.
> The First column represents what you enter, the 2nd column represents what
> the result is.
> 
> Part I: (Not required for re-creating error)
> | command                               | result                      |
> |---------------------------------------+-----------------------------|
> | '2sec(x)^2/tan(x)^2 - 2/tan(x)^2<RET> | 2sec(x)^2/ ...              |
> | s 1                                   | same                        |
> | a r  a/x + b/x := (a+b)/x <RET>       | (2 sec(x)^2 - 2) / tan(x)^2 |
> | a r sec(x)^2 := 1 + tan(x)^2 <RET>    | 2                           |
> 
> Part II: (required for re-creating error, because saving expressions)
> | command                          | result                      |
> |----------------------------------+-----------------------------|
> | ' a/x + b/x := (a+b)/x <RET>     | a/x + b/x := (a+b)/x        |
> | s t merge <RET>                  | disappear                   |
> | ' sec(x)^2 := 1 + tan(x)^2 <RET> | sec(x)^2 := 1 + tan(x)^2    |
> | s t secsqr <RET>                 | disappear                   |
> | r 1                              | 2sec(x)^2/...               |
> | a r merge <RET>                  | (2 sec(x)^2 - 2) / tan(x)^2 |
> | a r secsqr <RET>                 | 2                           |
> 
> 
> Exercise I:
> | command                | result                                   |
> |------------------------+------------------------------------------|
> | ' [merge,sinsqr] <RET> | [merge,sinsqr]                           |
> | =                      | [a / x + b / x := (a + b) / x, sinsqr]   |
> |                        | above, you can see sinsqr didn't expands |
> |                        |                                          |
> | s t trig <RET>         | disappear                                |
> | r 1                    | 2 sec(x)^2 / tan(x)^2 - 2 / tan(x)^2     |
> | a r trig <RET>         | 2 sec(x)^2 / tan(x)^2 - 2 / tan(x)^2     |
> |                        | above, you can see it didn't change.     |
> |                        | It should've outputted 2                 |
> 
> 
> Here is what I think it should be:
> Exercise I (My suggestion):
> | command                | result                                     |
> |------------------------+--------------------------------------------|
> | ' [merge,secsqr] <RET> | [merge,secsqr]                             |
> | =                      | [a / x + b / x := (a + b) / x, sec(x)^2... |
> |                        | above, you WILL see SECSQR expands         |
> |                        |                                            |
> | s t trig <RET>         | disappear                                  |
> | r 1                    | 2 sec(x)^2 / tan(x)^2 - 2 / tan(x)^2       |
> | a r trig <RET>         | 2                                          |
> |                        | above, you  WILL see 2                     |
> 
> 
> (Just in case, it might being helpful, I also attached the
> asciicinema recording in the email)

Thanks, I've now made the fix, and I'm closing this bug.