3
$\begingroup$

I want to use Needs to download the QuickReIm package to simplify the complex conjugation, but I keep getting errors:

here is the Command:

Needs["QuickReIm`"]

and here are the errors:

Get::noopen: Cannot open QuickReIm`.
Needs::nocont: Context QuickReIm` was not created when Needs was evaluated.

Do you know the reason? Where can I find different packages and their uses?

$\endgroup$
  • 1
    $\begingroup$ Is it in your Applications folder? $\endgroup$ – CA Trevillian Dec 28 '19 at 1:13
  • 3
    $\begingroup$ Needs does not download anything (please check its documentation). What it does is it loads a package, provided that that package is installed. Downloading the package and installing it is something you need to do yourself before the package can be used. "QuickReIm" is not a standard package. If you have a question about it, you should clarify where one can get this package. $\endgroup$ – Szabolcs Dec 28 '19 at 11:20
5
$\begingroup$

Not sure about the package you're referring to, but after a quick search I found Quantum Methods with Mathematica (result 5) which gives the source code for their version of the QuickReIm package as

BeginPackage["QuickReIm`"]
Begin["`Private`"]
protected = Unprotect[Re, Im, Conjugate]
Conjugate[expr_] := expr /. Complex[x_, y_] :> x - I y
Re[expr_] := Expand[(expr + Conjugate[expr])/2]
Im[expr_] := Expand[(expr - Conjugate[expr])/(2 I)]
Protect[Release[protected]]
End[]
EndPackage[]

And then Needs["QuickReIm`"] evaluates without error.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.