Git Product home page Git Product logo

Comments (8)

bernwo avatar bernwo commented on July 30, 2024

That is weird that the [esc]ket[esc] input alias did not work for you, because the input alias for Ket[] and Bra[] are built-in in Mathematica. BernDirac.wl does not have anything to do with defining the input alias of Ket[] and Bra[].

Perhaps try doing ClearAll["Global`*"] then see if the input alias works?

I am on Mathematica version 12.3 on Windows, and never had any issues with the input alias for either Bra[] or Ket[]. In fact, even without loading BernDirac.wl, you should be able to access these input aliases since they are built-in.

from berndirac.

dan87134 avatar dan87134 commented on July 30, 2024

It looks like it is a Mathematica problem. I quit the kernel and did a ClearAll just in case and (without loading your example) and [esc]ket[esc] does not work and Options[SelectedNotebook[], InputAliases] shows the Join error. I send a bug to Mathematica and I'll let you know what they say.

from berndirac.

dan87134 avatar dan87134 commented on July 30, 2024

I received response from Mathematica support. They could not reproduce the error I was having with bra/ket on macOS on Apple silicon.

They suggested that I wipe the config files for Mathematica and Wolfram... there are four of them in Library. I did that and the problem went away, the templates for bra and ket worked.

I don't know what put the config files in a bad state, it may have been loading BernDirac.wl. That's the only code I have used that uses bra and ket.

I should retry it to confirm that BernDirac was the source of the error but I won't do that for a while. If it is the problem I'd have to clear the Mathematica config again, which means I'd need to reactivate Mathematica, which leads to a license already in use error, which requires a call to Wolfram support to clear things up. But when I get a break I'll will do that.

from berndirac.

dan87134 avatar dan87134 commented on July 30, 2024

I had time to try loading BernDirac.wl into a clean configuration. Now the templates for bra and ket work just fine, so I don't know what corrupted my config.

However did run into another problem. The DirectForm function generates some errors in the BernDirac_examples.nb notebook. Specifically in some cases it generates and argument count error in the KroneckerProduct function.

I can't attach an .nb file but you can download my example from here https://danal-temp.s3.amazonaws.com/braketfail2.nb

Running your example files will produce the error on my machine too.

The errors that are produced look like this:

KroneckerProduct::argmu: KroneckerProduct called with 1 argument; 2 or more arguments are expected.

Thread::tdlen: Objects of unequal length in {{|0[RightAngleBracket],0},{0,|0[RightAngleBracket]}}+{[Alpha] |1[RightAngleBracket]} cannot be combined.

Note that I am running on Apple silicon, not Intel, Mathematica version 12.3.1.0.

In any case for what I am going to be doing I just need to basic bra ket templates to work. Thanks again for making this code available.

Dan

from berndirac.

bernwo avatar bernwo commented on July 30, 2024

Yes, I am aware of that bug. It happens when DiracForm[] is used on vectors/matrices that only have Hilbert space of a single qubit. It works if you use it on larger vectors/matrices. I am working on a fix.

from berndirac.

dan87134 avatar dan87134 commented on July 30, 2024

from berndirac.

bernwo avatar bernwo commented on July 30, 2024

Hi, the bugfix has been pushed to the main branch.

Additionally, I would like to point to a feature of Diracform which I haven't the time to write docstrings for.
Namely, you can change from the default computational basis to the X basis representation like so: DiracForm[Ket[0, 1], "Basis" -> {"X", "Z"}]. This outputs dirac notation where the first (left) qubit is shown in the X basis while the second (right) is shown in the Z basis.

from berndirac.

dan87134 avatar dan87134 commented on July 30, 2024

from berndirac.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.