pythonwolfram-mathematica

plot function using Mathematica


I need plot this function using Mathematica. I plot this in Python.

import numpy as np
import matplotlib.pyplot as plt

k = np.linspace(0,2,100)
j = 2*k

def I(k, j):

    II = k*j - k**2 - np.log(0.75)
    return II

plt.plot(j , I(k,j))
plt.show()

Solution

  • Test this VERY carefully to make certain that every detail is EXACTLY correct.

    k=Range[0,2,2/100];
    j=2*k;
    i[k_,j_]:=k*j-k^2-Log[0.75];
    ListPlot[Transpose[{j,i[k,j]}]]
    

    Check the documentation

    https://reference.wolfram.com/language/ref/Range.html https://reference.wolfram.com/language/ref/Transpose.html https://reference.wolfram.com/language/ref/ListPlot.html