Closed BowenFu closed 4 years ago
Thanks for the comments. I'll resolve them soon. I'll mark the PR as WIP For now.
Hi @soegaard can you help review the changes? I may create a new PR for new changes so that the PR won't get too larger.
I canceled the trig simplify in the PR, and added exponent for complex. The third root of -8 currently produce ( 1 + sqrt(3)I ).
Hi @soegaard , I have resolved most of the comments. Could you re-review the PR?
Hi @soegaard , I have resolved most of the comments. Could you re-review the PR?
Yes - but I am on vacation this week, so I can't promise to do it sooner than this weekend. But hopefully, I'll get some time before that.
/Jens Axel
Hi Bowen.
Right now I am working on adding your work on complex numbers (and together/combine etc) into racket-cas. I hope to be done tonight. I am making a few changes, so stay tuned (and don't add more commits to this pull request).
PS: If you are interested in an invite to the web-site I am building using racket-cas, send me an email: jensaxel@soegaard.net
I have incorporated your code and ideas in a new branch. I need to test it a bit before I make it the master. Your code for computing exponentials of complex numbers worked fine. I have however changed some things in the implementation.
Most importantly I changed the way normalize treat @i. Now it will always be the first symbol in a product (if the product has @i as a factor). That implies that the terms of a sum can be divided into terms that are "real" or "imaginary" by looking at the heads of the terms.
A few modifications to Expt meant that I was able to get rid of the memoized functions.
In the process I have broken two tests for together (I hope I can fix them), but all other tests work now.
See
https://github.com/soegaard/racket-cas/blob/BowenFu-master/racket-cas/racket-cas.rkt
I added your name to the readme.
Thanks for your work.
/Jens Axel
Thanks. And is the web-site on GitHub? I am glad to contribute.
Hi. Thanks for the offer! - but I wasn't looking for contributions to the web-site. The web site features math exercises for danish high school students. The hope is that I can sell subscriptions to schools eventually. /Jens Axel
Hi,
Great to see your interest in racket-cas!
I like some the commits in this pull request and am on the fence about others.
The rule
cos(x)^2 + sin^(x) = 1
doesn't belong in the automatic simplification. It does however belong in a trig-reduce [1]. Also placing the rule as-is in automatic simplification only handles the simplest case. Consider the case:2cos(x)^2 + 2sin(x)^2
. Here the rule doesn't apply. One way to reduce this is described in issue 2. [2]Wrt to complex numbers they are a useful addition, but I need them to be off as default. This might seem odd, but I am using racket-cas to produce exercises for an audience that don't know of complex numbers.
I suggest we add a parameter
complex-mode?
and use#:when (complex-mode?)
in the rules related to complex numbers. Rules that only apply for real numbers needs to have an#:when (not (complex-mode?))
add - I believe there were such a rule related to the product of powers.Finally as a rule try to add at least one test case for each rule you add. This serves partly as example of the rule, but it is also an insurance that new rules don't break existing rules. I regret I didn't apply this rule more rigorously from the beginning of the project - but I have found the test cases invaluable when modifying the rules.
When complex numbers are used, I think roots should produce the principal value instead of a real value. Example: The third root of -8 currently produce -2. Instead it should produce the principal value.
Feel free to write me an email: jensaxel@soegaard.net for further discussion.
/Jens Axel
[1] TrigReduce in Mathematica https://reference.wolfram.com/language/ref/TrigReduce.html [2] Issue 2 https://github.com/soegaard/racket-cas/issues/8