I'm working on some complex number calculators --- didn't know how to program in exponentiation and logarithms with Scratch.
If you don't know what arguments are, they are just angles on the complex plane. To make that clearer, the argument of a complex number a+bi is just the angle to the positive part of the real axis if you draw a line to the point (a,b)=a+bi on the complex plane. For example, the argument of 3i is 90 degrees.
Offline
I think any expnentation (pardon me for bad spelling ) would be
<(x) * (x)>
And just add however many times you need it.
And 100log is 10, right?
So any log equation would be <(x)/(10)>
Offline
mythbusteranimator wrote:
I think any expnentation (pardon me for bad spelling ) would be
<(x) * (x)>
And just add however many times you need it.
And 100log is 10, right?
So any log equation would be <(x)/(10)>
Actually, that's not what log does. Log100 is 2.
That's sorta like saying 5$ is 13, so $ means add 8. $ could be an operation for *2+3 or *3-2, etc.
Also, you can't just multiply a complex number as a real number, you have to treat it like a binomial.
Other than that, I'd like to help (a bit)
Offline
Just so you know, exponentiation is often extended like this:
a^-b=1/a^b
a^(1/2)=sqrt(a), the square root of a,
a^(1/3)=cbrt(a), the cube root of a,
and in general,
a^(1/n)=nroot(a), the nth root of a, and
e^(iradians)=cos(radians)+sin(radians)*i. The principal value of ln(a) is defined to be ln(radians)=ln(|radians|)+iarg(radians) where ln(a)=b if e^b=a (if a>0 and b is a real number), |a+bi|=sqrt(a^2+b^2), and arg(a) is the argument of a (restricted to -pi<arg(a)<=pi radians). (a<=b means a is less than or equal to b)
Now, we can use the exponential laws. Just in case you don't know, they are:
a^(b+c)=a^b*a^c,
a^(b-c)=a^b/a^c, and
a^(bc) a^b)^c.
And the change of base formula tells us how to find principal logarithms in any base:
log a base b=ln(a)/ln(b)
Also log a base b=c if b^c=a and log a base b=1/log b base a (assuming all logarithms are included). So a^(b/n)=a^(1/n*b) a^(1/n))^b=nroot(a)^b, and a^(b+ci) e^n(a))^(b+ci)=e^(ln(a)*(b+ci))=e^((ln(|a|)+iarg(a))(b+ci)). Now the (ln(|a|)+iarg(a))(b+ci) can be solved with FOIL. (ln(|a|)+iarg(a))(b+ci)=ln(|a|)b+iln(|a|)c+iarg(a)b+i^2*ln(c)=ln(|a|)b+iln(|a|)c+iarg(a)b-ln(c)=ln(|a|)-ln(c)+i*arg(a)b+i*ln(|a|)c. So, that means a^(b+ci)=e^((ln(|a|)-ln(c))+i(arg(a)b+ln(|a|)c)=e^(ln(|a|)-ln(c))*e^(i(arg(a)b+ln(|a|)c)=e^(ln(|a|)-ln(c))*(cos(arg(a)b+ln(|a|)c)+i*sin(arg(a)b+ln(|a|)c)) a|/c*(cos(arg(a)b+ln(|a|)c)+i*sin(arg(a)b+ln(|a|)c)) a|/c*(cos(arg(a)b+ln(|a|)c))+|a|/c*(i*sin(arg(a)b+ln(|a|)c)). The fact that this and the formula for logarithms uses arguments of complex numbers is the problem.
Offline
It should have been:
Just so you know, exponentiation is often extended like this:
a^-b=1/a^b
a^(1/2)=sqrt(a), the square root of a,
a^(1/3)=cbrt(a), the cube root of a,
and in general,
a^(1/n)=nroot(a), the nth root of a, and
e^(iradians)=cos(radians)+sin(radians)*i. The principal value of ln(a) is defined to be ln(radians)=ln(|radians|)+iarg(radians) where ln(a)=b if e^b=a (if a>0 and b is a real number), |a+bi|=sqrt(a^2+b^2), and arg(a) is the argument of a (restricted to -pi<arg(a)<=pi radians). (a<=b means a is less than or equal to b)
Now, we can use the exponential laws. Just in case you don't know, they are:
a^(b+c)=a^b*a^c,
a^(b-c)=a^b/a^c, and
a^(bc)=(a^b)^c.
And the change of base formula tells us how to find principal logarithms in any base:
log a base b=ln(a)/ln(b)
Also log a base b=c if b^c=a and log a base b=1/log b base a (assuming all logarithms are included). So a^(b/n)=a^(1/n*b)=(a^(1/n))^b=nroot(a)^b, and a^(b+ci)=(e^n(a))^(b+ci)=e^(ln(a)*(b+ci))=e^((ln(|a|)+iarg(a))(b+ci)). Now the (ln(|a|)+iarg(a))(b+ci) can be solved with FOIL. (ln(|a|)+iarg(a))(b+ci)=ln(|a|)b+iln(|a|)c+iarg(a)b+i^2*ln(c)=ln(|a|)b+iln(|a|)c+iarg(a)b-ln(c)=ln(|a|)-ln(c)+i*arg(a)b+i*ln(|a|)c. So, that means a^(b+ci)=e^((ln(|a|)-ln(c))+i(arg(a)b+ln(|a|)c)=e^(ln(|a|)-ln(c))*e^(i(arg(a)b+ln(|a|)c)=e^(ln(|a|)-ln(c))*(cos(arg(a)b+ln(|a|)c)+i*sin(arg(a)b+ln(|a|)c))=|a|/c*(cos(arg(a)b+ln(|a|)c)+i*sin(arg(a)b+ln(|a|)c))=|a|/c*(cos(arg(a)b+ln(|a|)c))+|a|/c*(i*sin(arg(a)b+ln(|a|)c)). The fact that this and the formula for logarithms uses arguments of complex numbers is the problem.
Offline
If we key in a=e, we get e^(b+ci) e|/c*(cos(arg(e)b+ln(|e|)c))+|e|/c*(i*sin(arg(e)b+ln(|e|)c))=e/c*(cos(b+c))+e/c*(i*sin(b+c)) and it follows that e^(b+ci)=e^b*e^(ci)=e^b*cos(c)+e^b*isin(c). Does that mean that e/c*(cos(b+c))+e/c*(isin(b+c))=e^b*cos(c)+e^b*isin(c)? I'm not quite sure if I did my math right ...
Offline
wiz99903 wrote:
Is there any way to find angles with Scratch? That would help me a lot.
Find angles? As in two lines intersecting?
Offline
Yes. We can get the principal argument if we use the formula arg(cos(x)+isin(x))=x if -Π<x<=Π. Any multiple like 1, 2, 3, etc. but not 1+i, 3+4i, i, -i, 2i, 5+5i, -1, -2, 5, -10, 0 etc. has the same argument.
Offline
wiz99903 wrote:
Because you can't just multiply 1+i by itself 3+4i times. That would be insane.
Insane, like you could compute 3^.5 by multiplying? Thatt's (again, I'm not too strict about my spelling) not possible.
Offline
that's right, you just can't. but you can cmpute (recall that i'm not too strict abuot my spelling) 3^.5 as sqrt(3), 9^(3+4i) as e^(ln(9)*(3+4i)) and then e^(ln(9)*3+ln(9)*4i) and then 9^3*cos(4ln(9))+i9^3*sin(4ln(9)) and then 729cos(4ln9)+729isin(4ln9).
Offline