AstusRush/AMaDiA

MacOS Installation Process

Opened this issue · 1 comments

cmholm commented

I've reviewed djbeadle's 2020 issue, and have seen a few of the same symptoms. That said, I thought I'd add my initial approach to installing AMaDiA on MacOS, in my case, Intel MacOS 13.6 (Ventura).

  • Launch the Terminal application and run the following steps within its console.
  • Install Xcode command line tools:

xcode-select --install

  • Install Homebrew (Instructions at https://brew.sh/).
  • After Homebrew installation is complete:
brew install git
brew install --cask anaconda # installs Anaconda 3
source ~/.zshrc # if using zsh
source ~/.bashrc # if using bash
conda install conda-forge::antlr4-python3-runtime
conda install -c conda-forge pyobjc
conda install -c conda-forge slycot
brew install mactex
eval "$(/usr/libexec/path_helper)" # or restart terminal
sudo tlmgr update --self
sudo tlmgr install dvipng
eval "$(/usr/libexec/path_helper)" # or restart terminal
vi ~/bin/AMaDiA/AMaDiA_Files/AMaDiA_Classes.py
:1083 # comment out, deprecated np.warnings
:1085 # comment out, deprecated np.warnings
:1128 # comment out, deprecated np.warnings
mkdir ~/bin
vi ~/bin/AMaDiA_INSTALL.sh
  • insert and save the following:
#!/usr/bin/env zsh
INSTALL_DIR=$HOME/bin
if [ ! -d “$INSTALL_DIR” ]; then
	mkdir -p $INSTALL_DIR
fi
cd $INSTALL_DIR
git clone https://github.com/AstusRush/AMaDiA

vi ~/bin/AMaDiA.sh

  • insert and save the following:
#!/usr/bin/env zsh
AMaDiA_DIR=$HOME/bin/AMaDia
cd $AMaDiA_DIR
git pull
if activate; then
        if python3 $AMaDiA_DIR/AMaDia.py; then
                echo "AMaDia executing"
        else
                echo “Error while launching AMaDiA, exiting…”
                exit 2
        fi
else
        echo “Error while launching Anaconda activate, exiting…”
        exit 1
fi

chmod o+x $HOME/bin/AMaDiA_INSTALL.sh
chmod o+x $HOME/bin/AMaDiA.sh
$HOME/bin/AMaDiA_INSTALL.sh
$HOME/bin/AMaDiA.sh

Results from examples:

  • s^3+5s^2+8s+4=0
    False: right side deviates by second3 + 5*second2 + 8*second + 4
  • roots(s^3+5s^2+8s+4)
    roots(s^3+5s^2+8s+4) = {-1: 1, -2: 2}
  • x²+3x-4=0
    [ {x: -4} , {x: 1} ]
  • x^20+5·x^19-3·x^18+2·x^17+18·x^17+2·x^16+19·x^15+2·x^14-19·x^13-99·x^12+x^11-14·x^10+3·x^9-15·x^8-12·x^7+70·x^6-104·x^5+x^4-3·x^3+x²+2·x-5=0
    <class 'ValueError'> in AMaDiA_Classes.py line 660
    x^20+5·x^19-3·x^18+2·x^17+18·x^17+2·x^16+19·x^15+2·x^14-19·x^13-99·x^12+x^11-14·x^10+3·x^9-15·x^8-12·x^7+70·x^6-104·x^5+x^4-3·x^3+x²+2·x-5=0 ==> [ {x: -6.04773571888917} , {x: -1.0250326906027} , {x: -0.519247737106139} , {x: 1.28374880067676} , {x: -1.10141297857819 - 0.692831199945115·I} , {x: -1.10141297857819 + 0.692831199945115·I} , {x: -0.182946451101471 - 0.517800980196802·I} , {x: -0.182946451101471 + 0.517800980196802·I} , {x: -0.552155232233211 - 0.930186898687355·I} , {x: -0.552155232233211 + 0.930186898687355·I} , {x: -0.0756886854576322 - 1.59356606867508·I} , {x: -0.0756886854576322 + 1.59356606867508·I} , {x: 0.351371712758973 - 0.914333003500366·I} , {x: 0.351371712758973 + 0.914333003500366·I} , {x: 0.44076366517051 - 0.33765852950478·I} , {x: 0.44076366517051 + 0.33765852950478·I} , {x: 0.80060470751489 - 0.375687281322787·I} , {x: 0.80060470751489 + 0.375687281322787·I} , {x: 0.973596934886756 - 1.57844845108437·I} , {x: 0.973596934886756 + 1.57844845108437·I} ]
  • integrate(sqrt(sin(x))/(sqrt(sin(x))+sqrt(cos(x))),(x,0,pi/2))
    ∫(√(sin(x))/(√(sin(x))+√(cos(x))),(x,0,π/2)) = 0.785398163397448
  • int {(0)(3)}int {(0)(x)}a^2da+x dx + int {(0)(3)}x^2*dx
    ∫{(0)(3)}∫{(0)(x)}a^2da+x dx + ∫{(0)(3)}x^2·dx = 20.25
  • ((3)(∫ d(x²)/dx+x dx)(2))/6
    ((3)(∫ d(x²)/dx+x dx)(2))/6 = 1.5·x^2
  • d(y(t))/dt=-λ·y(t)
    d(y(t))/dt=-λ·y(t) ==> {λ: -Derivative(y(tonne), tonne)/y(tonne)}
  • x'(t) *x(t)^2 = sin(0.2 + t)
    x'(t) ·x(t)^2 = sin(0.2 + t) ==> [ {x(tonne): -(sin(tonne + 0.2)/Derivative(x(tonne), tonne))^0.5} , {x(tonne): (sin(tonne + 0.2)/Derivative(x(tonne), tonne))^0.5} ]
  • ∫1dy+∫7x*dx=0
    ∫1dy+∫7x·dx=0 ==> {y: -3.5·x^2}
  • y''(x) = 0 , y(4)=1 , y'(1)=2
    y''(x) = 0 , y(4)=1 , y'(1)=2 ==> y(x) = 2.0·x - 7.0
  • d(x(t))/dt = 5x(t)-3 , x(2)=1
    <class 'AssertionError'> in AMaDiA_Classes.py line 957 :
    <class 'SyntaxError'> in AMaDiA_Classes.py line 802 : invalid syntax (, line 1)
    d(x(t))/dt = 5x(t)-3 , x(2)=1 ==> x(t) = 1.81599719049939e-5exp(5t) + 0.6
  • y(x)·(2x^4+y(x))·y'(x)=(1-4·x·(y(x))^2)·x^2
    Killed process after 3 hours on a 3.1 GHz Quad-Core Intel Core i7, 16GB RAM.
  • pdsolve(1 + (2·(d(u(x,y))/dx)/u(x,y)) + (3·(d(u(x,y))/dy)/u(x,y)))
    pdsolve(1 + (2·(d(u(x,y))/dx)/u(x,y)) + (3·(d(u(x,y))/dy)/u(x,y))) = Eq(u(x, y), F(3·x - 2·y)·exp(-2·x/13 - 3·y/13))
  • pdsolve(1 + (2*(d(u(x,y))/dx)) + (3*(d(u(x,y))/dy)))
    pdsolve(1 + (2·(d(u(x,y))/dx)) + (3·(d(u(x,y))/dy))) = Eq(u(x, y), -0.153846153846154·x - 0.230769230769231·y + F(3·x - 2·y))
  • Sum(1/(k-3),(k,4,8)) = 137/60
    <class 'tokenize.TokenError'> in AMaDiA_Classes.py line 956 : ('EOF in multi-line statement', (2, 0))
    (Sum(1/(k-3),(k,4,8)) ) - ( 137/60)
    14:25:41 :
    <class 'ValueError'> in AMaDiA_Classes.py line 660 : The function cannot be automatically detected for 0.
    Sum(1/(k-3),(k,4,8)) = 137/60 ==> True
  • z6 = 1
    <class 'ValueError'> in AMaDiA_Classes.py line 660 : The function cannot be automatically detected for z
    6 - 1.
    z^6 = 1 ==> [ {z: -1} , {z: 1} , {z: -0.5 - 0.866025403784439·I} , {z: -0.5 + 0.866025403784439·I} , {z: 0.5 - 0.866025403784439·I} , {z: 0.5 + 0.866025403784439·I} ]
  • z3 = -2+2*I
    <class 'ValueError'> in AMaDiA_Classes.py line 660 : The function cannot be automatically detected for z
    3 + 2 - 2*I.
    z^3 = -2+2·I ==> [ {z: -1.36602540378444 + 0.366025403784439·I} , {z: 0.366025403784439 - 1.36602540378444·I} , {z: 1 + 1·I} ]
  • 4 in ImageSet(Lambda(x, x**2), S.Naturals) # Checks if 4 is a square number
    <class 'AttributeError'> in AMaDiA_Functions.py line 314 : 'Quantity' object has no attribute 'Naturals'
    14:28:50 :
    <class 'AttributeError'> in AMaDiA_Classes.py line 802 : 'Quantity' object has no attribute 'Naturals'
    4 in ImageSet(Lambda(x, x^2), S.Naturals) # Checks if 4 is a square number ==> True
  • 1 if 4 in [1,2,3,5,6]+[4,8] else 0
    1 if 4 in [1,2,3,5,6]+[4,8] else 0 = 1
  • 1 if 4 in [1,2,3,4,5,6] and 4 not in [4,8] else 0
    1 if 4 in [1,2,3,4,5,6] and 4 not in [4,8] else 0 = 0
  • 22 if 2>3 else 23
    2·2 if 2>3 else 2·3 = 6
  • inverse_laplace_transform(1/s,s,x)
    inverse_laplace_transform(1/s,s,x) = Heaviside(x)
  • laplace_transform(exp(x),x,s)[0]
    laplace_transform(exp(x),x,s)[0] = 1/(second - 1)
  • convert_to(7foot+3inch,[m])
    convert_to(7foot+3inch,[m]) = 2.2098·meter
  • d(y(t))/dt=-y(t)·λ # LaTeX
    LaTeX output looks good.
  • y(t)= C1exp(-λt) # LaTeX
    LaTeX output looks good.
  • integrate(sqrt(sin(x))/(sqrt(sin(x))+sqrt(cos(x)))) # plot
    [-10. -9.97997998 -9.95995996 ... 9.95995996 9.97997998
    10. ] <class 'numpy.ndarray'>
    :4: RuntimeWarning: invalid value encountered in sqrt
    Integral(sqrt(sin(x))/(sqrt(sin(x)) + sqrt(cos(x))), x))
    Warning in AMaS for integrate(sqrt(sin(x))/(sqrt(sin(x))+sqrt(cos(x))))
    :2: RuntimeWarning: invalid value encountered in sqrt
    return (sqrt(sin(x))/(sqrt(sin(x))+sqrt(cos(x))))
    Warning in AMaS for integrate(sqrt(sin(x))/(sqrt(sin(x))+sqrt(cos(x))))
    /Users/cmholm/bin/AMaDiA/AMaDiA_Files/AMaDiA_Classes.py:1108: IntegrationWarning: The occurrence of roundoff error is detected, which prevents
    the requested tolerance from being achieved. The error may be
    underestimated.
    return scipy.integrate.quad(evalfunc, 0, X)
    <class 'ValueError'> in AMaDiA_Classes.py line 1065 : Invalid limits given: (array([-10. , -9.97997998, -9.95995996, ..., 9.95995996,
    9.97997998, 10. ]),)
  • sqrt(sin(x))/(sqrt(sin(x))+sqrt(cos(x))) # plot
    [-10. -9.97997998 -9.95995996 ... 9.95995996 9.97997998
    10. ] <class 'numpy.ndarray'>
    :2: RuntimeWarning: invalid value encountered in sqrt
    return sqrt(sin(x))/(sqrt(sin(x)) + sqrt(cos(x)))
    (note: plot appears to be correct)
  • (0<x)(x<1)+(x>1)·(x<3)·x+(3<x)·(sin((x-3)*8)/8+3) # plot
    <class 'TypeError'> in AMaDiA_Functions.py line 314 : Relational cannot be used in Mul
    <class 'TypeError'> in AMaDiA_Classes.py line 457 : unsupported operand type(s) for *: 'StrictLessThan' and 'StrictLessThan'
    <class 'TypeError'> in AMaDiA_Classes.py line 1039 : unsupported operand type(s) for *: 'StrictLessThan' and 'StrictLessThan'
    (note: no plot)
  • (abs(sin(x))>0.3)(abs(sin(x))<0.7)(-sin(x)+0.3(sign(sin(x))))+sin(x) # plot
    <class 'TypeError'> in AMaDiA_Functions.py line 314 : Relational cannot be used in Mul
    <class 'TypeError'> in AMaDiA_Classes.py line 457 : unsupported operand type(s) for *: 'StrictGreaterThan' and 'StrictLessThan'
    <class 'TypeError'> in AMaDiA_Classes.py line 1039 : unsupported operand type(s) for *: 'StrictGreaterThan' and 'StrictLessThan'
    (note: no plot)

Thank you for sharing this. I will link this issue on the install section of the readme.

I was at first confused by the output for the plot examples until I realised that they were inputted into the calculator tab instead of the plot tab. It seems that I should improve my examples to make it clearer that these inputs should be done in the plot tab, however I also like the idea of making the parser recognise #plot to automatically redirect the query to the plot tab. I might add that.

(Also, sorry for this late response, I was occupied with my bachelor thesis for the past few months.)