TypeError: non-boolean (Num) used in boolean context with symbolic Julia, How to fix?

Viewed 70

Opened an issue as suggested. https://github.com/JuliaSymbolics/Symbolics.jl/issues/718


I wanted to translate this

enter image description here

To Julia. So Installed symbolics, defined x but get an error. The following is the code

>julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.7.3 (2022-05-06)
 _/ |\__'_|_|_|\__'_|  |  
|__/                   |

julia> using Symbolics

julia> @variables x
1-element Vector{Num}:
 x

julia> sqrt(-im+x)
ERROR: TypeError: non-boolean (Num) used in boolean context
Stacktrace:
 [1] sqrt(z::Complex{Num})
   @ Base ./complex.jl:501
 [2] top-level scope
   @ REPL[3]:1

julia> 

Noticed that im+x works. But sqrt(im+x) gives the error.

What is the problem and is there a workaround?

0 Answers
Related