Skip to content

Complex numbers - to polar and from polar form #135

Answered by PaddiM8
RudolfSch asked this question in Q&A
Discussion options

You must be logged in to vote

Hello! If you want to return two values, you can do that by doing something like (abs(x), arg(x)) (wrapping them in parenthesis). Then you can access an inner value with the syntax value[[i]] or var_i, for example:

pol(x) = (abs(x), arg(x))
v = pol(3 - 4i)
x = v_1
y = v_2

x = v[[1]]
y = v[[2]]

As for the other issue, there seems to be a problem in kalker with having function parameters with several letters (eg. phirad), but replacing it with p makes it work for me (this is something I'll have to fix in the future, but it is probably only an issue with function parameters, not regular variables).

cart(A, p) = A*cos(p)+A*i*sin(p)

It looks like you placed default.kalker in the right folder,…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@PaddiM8
Comment options

Answer selected by RudolfSch
@RudolfSch
Comment options

@PaddiM8
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants