| Deutsch English Français Italiano |
|
<vpleh2$26m27$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Newsgroups: sci.math
Subject: Re: Equation complexe
Date: Tue, 25 Feb 2025 14:00:01 -0800
Organization: A noiseless patient Spider
Lines: 60
Message-ID: <vpleh2$26m27$1@dont-email.me>
References: <oAvE_mEWK82aUJOdwpGna1Rzs1U@jntp> <vpldtr$26m33$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 25 Feb 2025 23:00:02 +0100 (CET)
Injection-Info: dont-email.me; posting-host="8c80fd11f2165122cd338651f5e23fca";
logging-data="2316359"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/p4eOaeySM3J7UDyp8rPtSGV5LRTfXRI0="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:BCjuk8FyqILRPDC/mtuTM8pNhvM=
Content-Language: en-US
In-Reply-To: <vpldtr$26m33$1@dont-email.me>
Bytes: 2488
On 2/25/2025 1:49 PM, Chris M. Thomasson wrote:
> On 2/25/2025 6:23 AM, Richard Hachel wrote:
>> x^4=-81
>>
>> What is x?
>
>
> Try to forgive the floating point precision aspects, but, the roots are
> the r's, raising them to the 4'th power gives the p's:
> _____________________
> r0 = (2.12132,2.12132)
> r1 = (-2.12132,2.12132)
> r2 = (-2.12132,-2.12132)
> r3 = (2.12132,-2.12132)
>
> p0 = (-81,-7.08124e-06)
> p1 = (-81,-1.93183e-06)
> p2 = (-81,-7.53158e-05)
> p3 = (-81,4.57051e-05)
> _____________________
>
>
> To gain a root, here is my code:
> _____________________
> ct_complex
> root_calc(
> ct_complex const& z,
> int p,
> int n
> ) {
> float radius = std::pow(std::abs(z), 1.0 / p);
> float angle_base = std::arg(z) / p;
> float angle_step = (CT_PI * 2.0) / p;
> float angle = angle = angle_step * n;
^^^^^^^^^^^^^^^^^^^^^^
It still compiles and works wrt C++, but this looks odd to me. I typed
this in the newsreader just to see if I could remember it.
That line should be:
float angle = angle_step * n;
>
> ct_complex c = {
> std::cos(angle_base + angle) * radius,
> std::sin(angle_base + angle) * radius
> };
>
> return c;
> }
> _____________________
>
>
> Also, this is not using floating point for roots, just signed integers.