Q:

python --> scilab error of translation

My scilab is not displaying anything concerning my attempt to traduce a "Oscillateurs mécaniques couplés" problem from python to scilab but it should dislay 3 graphs representing oscillations
Here is the python:
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint
m1=1;m2=1;k1=1;k2=1;k3=1;m=1;k=1;a=1;
def equadiff(var,t):
    x1=var[0]
    x2=var[1]
    v1=var[2]
    v2=var[3]
    a1=( k2*x2-(k1+k2)*x1)/m1
    a2=( k2*x1-(k2+k3)*x2)/m2
    return ([v1,v2,a1,a2])
def Oscillateur(x10,x20,v10,v20,tmax):
    t=np.linspace(0,tmax,300)
    fig = plt.figure()
    ax = fig.add_subplot(1,1,1,aspect="equal")
    ax.spines["left"].set_position("zero")
    ax.spines["right"].set_color("none")
    ax.spines["bottom"].set_position("zero")
    ax.spines["top"].set_color("none")
    ax.xaxis.set_ticks_position("bottom")
    ax.yaxis.set_ticks_position("left")
    plt.axis("tight")
    var0=[x10,x20,v10,v20]
    solution=odeint(equadiff,var0,t)
    x1=solution[:,0]
    x2=solution[:,1]
    v1=solution[:,2]
    v2=solution[:,3]
    plt.plot(t,x1,t,x2)
    plt.axis("tight")
    plt.show()
Oscillateur(a,a,0,0,10)
Oscillateur(a,-a,0,0,10)
Oscillateur(2*a,0,0,0,50)

Here is my scilab the problem is located within this code my guess would be those ax.yaxis.set_ticks_position("left") but i cant figure out how to solve it and display my graph:
m1=1;m2=1;k1=1;k2=1;k3=1;m=1;k=1;a=1;

function S=equadiff(var,t)
    x1=var(0)
    x2=var(1)
    v1=var(2)
    v2=var(3)
    a1=(k2*x2-(k1+k2)*x1)/m1
    a2=(k2*x1-(k2+k3)*x2)/m2
    disp([v1,v2,a1,a2])
endfunction

function T=Oscillateur(x10,x20,v10,v20,tmax)
  t=linspace(0,tmax,300)
  figure()
  ax=subplot(1,1,1,aspect="equal")
  var0=[x10,x20,v10,v20]
  solution=ode(var0,t0,t,equadiff)
  x1=solution(:,0)
  x2=solution(:,1)
  v1=solution(:,2)
  v2=solution(:,3)
  plot(t,x1,t,x2)
  a=gca()
  a.x_location = "zero";
  axis("tight");
endfunction 

disp(Oscillateur(a,a,0,0,10)) 
disp(Oscillateur(a,-a,0,0,10))
disp(Oscillateur(2*a,0,0,0,50))

A:

Lot's of errors here:

equadiff returns S which is not declared.
Scilab indexing start at 1
subplot doesn't have an argument named "aspect".
t0 is undefined.
equadiff arguments must be t,var in that order.
x argument must be a column vector if t is a row vector.
Oscillateur returns T which is not declared.
disp cannot returns this empty return.
x_location property doesn't exist for axes handle

Fixing all theses errors gives you :
m1=1;m2=1;
k1=1;k2=1;k3=1;
m=1;
k=1;
a=1;

// added k1,k2,k3 m1,m2 as argument
function S=equadiff(t,x,k1,k2,k3,m1,m2)
    x1=x(1)
    x2=x(2)
    v1=x(3)
    v2=x(4)
    a1=(k2*x2-(k1+k2)*x1)/m1
    a2=(k2*x1-(k2+k3)*x2)/m2
    S=[v1;v2;a1;a2] // now equadiff returns an 4 by 1 vector
endfunction

// added k1,k2,k3 m1,m2 as argument
// Removed T as not used
function Oscillateur(x10,x20,v10,v20,tmax,equadiff,k1,k2,k3,m1,m2)
  t=linspace(0,tmax,300)
  figure()
  var0=[x10;x20;v10;v20] // x is 4 by 1 vector
  solution=ode(var0,0,t,list(equadiff,k1,k2,k3,m1,m2)) // k1 ,etc ar now passed as additionnal argument for equadiff
  // since equadiff returns a 4 by 1 vector and t is 1 by 300
  // solution is 4 by 300
  x1=solution(1,:)
  x2=solution(2,:)
  v1=solution(3,:)
  v2=solution(4,:)
  plot(t,x1,t,x2)
  legend('x1','x2')
  a=gca()
  //a.x_location = "zero"; //  what was that for ?
  set(a,"tight_limits","on");
endfunction 

// Display is only for printing value.
Oscillateur(a,a,0,0,10,equadiff,k1,k2,k3,k1,m2)
Oscillateur(a,-a,0,0,10,equadiff,k1,k2,k3,k1,m2)
Oscillateur(2*a,0,0,0,50,equadiff,k1,k2,k3,k1,m2)

