SMath Studio Forum
»
SMath Studio
»
Questions
»
Is there a way to get ride of complex numbers?
Rank: Newbie
Groups: Registered
Joined: 25/05/2021(UTC) Posts: 7 Location: Australia
|
hi Folks, I am programming some equations and there is a requirement for a summation of terms, each term being a square root of a function of several variables. The method requires ignoring any negative results, i.e. where the square root of a negative number will lead to a complex number.
The terms are all have identical variables and it would be ideal if I can perform some operation on the general case term, so that the imaginary results just vanish.
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 28/08/2014(UTC) Posts: 1,356 Was thanked: 815 time(s) in 516 post(s)
|
Hi. You can try to redefine i:=0 and see if get the desired behavior.
Best regards. Alvaro.
|
|
|
|
Rank: Member Groups: Registered
Joined: 17/05/2021(UTC) Posts: 19 Was thanked: 5 time(s) in 4 post(s)
|
There is a function called Re that returns the real part of a complex number. See example below For reference: The counterpart is the function Im, see below. Edited by user 26 May 2021 08:58:45(UTC)
| Reason: Not specified
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: Jean Giraud Your description is too general w/o the formula. Circle Complexn-circles.sm (11kb) downloaded 11 time(s).
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 25/05/2021(UTC) Posts: 7 Location: Australia
|
hi folks, thanks for your contributions the way I've solved my dilemma was to multiply each term by (X>0) so that whenever X is less than zero the sqrt(X*(X>0)) becomes zero.
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: 009jim the way I've solved my dilemma You have solved nothing yet from nothing to pass QA !
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 25/05/2021(UTC) Posts: 7 Location: Australia
|
Originally Posted by: Jean Giraud Your description is too general w/o the formula.
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 28/08/2014(UTC) Posts: 1,356 Was thanked: 815 time(s) in 516 post(s)
|
Hi Jim. Actually your dilemma isn't trivial and the solution that you found it's complete in the sense that you extend over the integers an operation only well defined for the natural numbers. For integers, rationals, reals, complexes, vectors, matrices, tensors ... are only conventions based on definitions by convenience, very very good ones ... but not theorems. For example Maple have the function surd for deal with roots with integers when the usual convention doesn't work. Because power don't commute have two inverses, one by the left and other by the right, roots and logarithms, complicating the things. This is the help for the surd function from Maple website: https://www.maplesoft.co...aple/view.aspx?path=surdAs you can see, if you ask to Maple for convert surd, it returns just x^(1/n). So, you can define your own function pow3(x) = x^3 * (x > 0). Or maybe more general some CheckPos(x) for make more readable your expression. Best regards. Alvaro.
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: 009jim Your description is too general w/o the formula. Attach the *.sm document.
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: Jean Giraud Attach the *.sm document. ... do some effort: split that monster, zap subscript, make minimalist like visiting doctor. Page10 Split Monster.sm (477kb) downloaded 8 time(s).
|
|
|
|
SMath Studio Forum
»
SMath Studio
»
Questions
»
Is there a way to get ride of complex numbers?
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.