# How to acces the array element of symbolic array

Hi All, I want to convert matlab code to julia. is there a way to access elements of symbolic expression.

``````function [xqq,xq,wq]=SetIntoptimal1D(n)

clc
#clear all;
syms y
# Input n: Quad pt rule

m=n-1;
P=sym('a',[1,n]);
P(1)=1;
P(2)=y;

for i=1:m

P(i+2)=((2.0*i+1)*y*P(i+1)-(i)*P(i))/(i+1.0);
# P(i)=P(i+1);
# P(i+1)=P(i+2);
end
if n==1
P(n)=P(1);
end
p=n-1;
t=p/(p+1);
#Pn=expand(P(n+1));
Pn=expand(P(n+1)-t*P(n-1));
xqq=solve(vpa(Pn,32));
xqq=sort(xqq);
#update here
xq=zeros(n);
parfor i=1:n
xq(i)=(xqq(i)+1)/2;
end
xq=sort(xq);

for k=1:1:n
P(1)=1;
P(2)=y;
m=n;

for i=1:m

P(i+2)=((2.0*i+1)*y*P(i+1)-(i)*P(i))/(i+1.0);

end

P1=((n+1)/(1-y*y))*(y*P(n+1)-P(n+2));
P2=((n-1)/(1-y*y))*(y*P(n-1)-P(n));
Pn=P(n)*(P1-t*P2);
#Pn=x*P(n+1)-P(n+2);

wqq(k)=vpa(2*(p*(1+t)+t)/(p*(p+1))/...
subs(Pn,y,xqq(k)),32);

end

parfor i=1:n
wq(i)=wqq(i)/2;
end
# disp('Nodes');
#  disp(xq);
#  disp('Weights')
#  disp(wq)
end
Julia code converted so far

using Symbolics
@variables y
# Input n: Quad pt rule

n=10
m=n-1;
@variables P[1:n]
Symbolics.scalarize(P)``````