Thanks works fine, in fact I use sagemath(python,matplotlib)
and as I have a lot of programs to translate in ijulia I often fail.
Without your help I couldn't imagine all these modifications.
Julia list is terrific :) Quick and valid answers most the time :)
My code with your suggestions :

using PyPlot
plt=PyPlot
R=100;L=10;C=10E-6;w=1/(sqrt(L*C));omega=0;
omega=linspace(0,2w)
y=abs(1./(1+im.*omega.*R.*C-omega.*omega.*L.*C));
fig = figure("Angle")
plt.plot(omega, y);
plt.ylabel("z");
plt.xlabel("w");
ax = plt.gca() # get current axes
ax[:set_xlim]((0,2*w));
ax[:set_ylim]((0,10));
plt.grid("on")
plt.title("Pulsation");

Le mercredi 15 juin 2016 08:52:30 UTC+2, Henri Girard a écrit :
>
> Hi,
>
> I would like to transform this python working example into a ijulia 
> program ,
> Any help
> HG
>
> var("w")
> u=1/pi*360;s=1/(pi*360)
> R=100;L=10;C=10E-6
> w=1/(sqrt(L*C));var('omega')
>
> p=plot(abs(1/(1+i*omega*R*C-omega*omega*L*C)),omega,0,2*w,figsize=4,frame=True,
> fontsize=8,axes=False,color="green") ;show(p)
> print"Pulsation angulaire = ",round(w)," Rad/s"
>
> I tried this but got errors :
> R=100;L=10;C=10E-6;w=1/(sqrt(L*C));omega=0;
> x=linspace(0,2pi)
> y=(abs(1/(1+im*omega*R*C-omega*omega*L*C)));
> fig = figure("Angle")
> plt.plot(x, y);
> plt.ylabel("z");
> plt.xlabel("w");
> ax = plt.gca() # get current axes
> ax[:set_xlim]((0,2*w));
> ax[:set_ylim]((0,10));
> plt.grid("on")
> plt.title("Pulsation");
>
>
> LoadError: PyError (:PyObject_Call) <type 'exceptions.ValueError'>
> ValueError(u'x and y must have same first dimension',)
>   File 
> "/home/pi/.julia/v0.4/Conda/deps/usr/lib/python2.7/site-packages/matplotlib/pyplot.py",
>  line 3154, in plot
>     ret = ax.plot(*args, **kwargs)
>   File 
> "/home/pi/.julia/v0.4/Conda/deps/usr/lib/python2.7/site-packages/matplotlib/__init__.py",
>  line 1812, in inner
>     return func(ax, *args, **kwargs)
>   File 
> "/home/pi/.julia/v0.4/Conda/deps/usr/lib/python2.7/site-packages/matplotlib/axes/_axes.py",
>  line 1424, in plot
>     for line in self._get_lines(*args, **kwargs):
>   File 
> "/home/pi/.julia/v0.4/Conda/deps/usr/lib/python2.7/site-packages/matplotlib/axes/_base.py",
>  line 386, in _grab_next_args
>     for seg in self._plot_args(remaining, kwargs):
>   File 
> "/home/pi/.julia/v0.4/Conda/deps/usr/lib/python2.7/site-packages/matplotlib/axes/_base.py",
>  line 364, in _plot_args
>     x, y = self._xy_from_xy(x, y)
>   File 
> "/home/pi/.julia/v0.4/Conda/deps/usr/lib/python2.7/site-packages/matplotlib/axes/_base.py",
>  line 223, in _xy_from_xy
>     raise ValueError("x and y must have same first dimension")
>
> while loading In[38], in expression starting on line 2
>
>  [inlined code] from /home/pi/.julia/v0.4/PyCall/src/exception.jl:81
>  in pycall at /home/pi/.julia/v0.4/PyCall/src/PyCall.jl:502
>
>
>

Reply via email to