Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prime notation not working #143

Open
islent opened this issue Dec 12, 2019 · 2 comments
Open

Prime notation not working #143

islent opened this issue Dec 12, 2019 · 2 comments

Comments

@islent
Copy link

islent commented Dec 12, 2019

Example code copied from README not working (julia-1.3.0, Calculus-0.5.1):

julia> using Calculus

julia> f(x) = sin(x)
f (generic function with 1 method)

julia> f'(1.0) - cos(1.0)
ERROR: MethodError: no method matching adjoint(::typeof(f))
Closest candidates are:
  adjoint(::Missing) at missing.jl:100
  adjoint(::Number) at number.jl:193
  adjoint(::LinearAlgebra.Adjoint) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.3\LinearAlgebra\src\adjtrans.jl:152
  ...
Stacktrace:
 [1] top-level scope at REPL[3]:1

julia> f''(1.0) - (-sin(1.0))
ERROR: MethodError: no method matching adjoint(::typeof(f))
Closest candidates are:
  adjoint(::Missing) at missing.jl:100
  adjoint(::Number) at number.jl:193
  adjoint(::LinearAlgebra.Adjoint) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.3\LinearAlgebra\src\adjtrans.jl:152
  ...
Stacktrace:
 [1] top-level scope at REPL[6]:1
@willowell
Copy link

willowell commented Jan 24, 2020

I'm having the same problem with JuliaPro-1.2.0-2 with Julia 1.2.0 on macOS 10.15.1.
Steps:

  1. Start JuliaPro
  2. Start Julia REPL
  3. Enter `Pkg.add("Calculus")
  4. Enter using Calculus
  5. Enter f(x) = x
  6. Enter f'(0)
  7. REPL errors: ERROR: MethodError: no method matching adjoint(::typeof(f))

It appears as though Julia is mistaking the Calculus package's prime notation operator for the Hermitian adjoint operator in the standard library. julia/stdlib/v1.2/LinearAlgebra/adjtrans.jl specifically mentions:

Lazy adjoint (conjugate transposition) (also postfix `'`).
Note that `adjoint` is applied recursively to elements.

in a comment at line 105 and 106.

derivative(f, 0) behaves normally.

@birm
Copy link

birm commented Mar 11, 2020

Looks like this comes out of #133

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants