Discussion:
converting sym to double
(too old to reply)
ekrem
2011-05-29 09:18:02 UTC
Permalink
Hello everyone,

I am trying to evaluate the numerical value of r. It gives the following error.How can I convert r to a double variable?

r = int('a*sin(b*x)')
r =

-(a*cos(b*x))/b
a=3
a =

3
b=4
b =

4
x=7
x =

7
double(r)
??? Error using ==> mupadmex
Error in MuPAD command: DOUBLE cannot convert the input expression into a double array.

If the input expression contains a symbolic variable, use the VPA function instead.

Error in ==> sym.sym>sym.double at 927
Xstr = mupadmex('mllib::double', S.s, 0);
Wayne King
2011-05-29 09:39:04 UTC
Permalink
Post by ekrem
Hello everyone,
I am trying to evaluate the numerical value of r. It gives the following error.How can I convert r to a double variable?
r = int('a*sin(b*x)')
r =
-(a*cos(b*x))/b
a=3
a =
3
b=4
b =
4
x=7
x =
7
double(r)
??? Error using ==> mupadmex
Error in MuPAD command: DOUBLE cannot convert the input expression into a double array.
If the input expression contains a symbolic variable, use the VPA function instead.
Error in ==> sym.sym>sym.double at 927
Xstr = mupadmex('mllib::double', S.s, 0);
Hi, Are you trying to evaluate your antiderivative at a point? Use subs()

syms x
r = int(3*sin(4*x));
subs(r,7)


Wayne
ekrem
2011-05-29 10:51:02 UTC
Permalink
Post by Wayne King
Post by ekrem
Hello everyone,
I am trying to evaluate the numerical value of r. It gives the following error.How can I convert r to a double variable?
r = int('a*sin(b*x)')
r =
-(a*cos(b*x))/b
a=3
a =
3
b=4
b =
4
x=7
x =
7
double(r)
??? Error using ==> mupadmex
Error in MuPAD command: DOUBLE cannot convert the input expression into a double array.
If the input expression contains a symbolic variable, use the VPA function instead.
Error in ==> sym.sym>sym.double at 927
Xstr = mupadmex('mllib::double', S.s, 0);
Hi, Are you trying to evaluate your antiderivative at a point? Use subs()
syms x
Post by Wayne King
r = int(3*sin(4*x));
subs(r,7)
Wayne
Hey, Thanks a lot. It's helping and I am trying.

But I have a new problem.

what if,

I want to find r when,
r = int(y*sin(4*x)); ??

Should I do this;
syms x
syms y
Post by Wayne King
r = int(y*sin(4*x));
subs(r,7,5) ??
Thanks!!
Wayne King
2011-05-29 11:04:20 UTC
Permalink
Post by Wayne King
Post by Wayne King
Post by ekrem
Hello everyone,
I am trying to evaluate the numerical value of r. It gives the following error.How can I convert r to a double variable?
r = int('a*sin(b*x)')
r =
-(a*cos(b*x))/b
a=3
a =
3
b=4
b =
4
x=7
x =
7
double(r)
??? Error using ==> mupadmex
Error in MuPAD command: DOUBLE cannot convert the input expression into a double array.
If the input expression contains a symbolic variable, use the VPA function instead.
Error in ==> sym.sym>sym.double at 927
Xstr = mupadmex('mllib::double', S.s, 0);
Hi, Are you trying to evaluate your antiderivative at a point? Use subs()
syms x
Post by Wayne King
r = int(3*sin(4*x));
subs(r,7)
Wayne
Hey, Thanks a lot. It's helping and I am trying.
But I have a new problem.
what if,
I want to find r when,
r = int(y*sin(4*x)); ??
Should I do this;
syms x
syms y
Post by Wayne King
r = int(y*sin(4*x));
subs(r,7,5) ??
Thanks!!
Hi Ekrem, I'm assuming you want to integrate with respect to x in the above

syms x y;
r = int(y*sin(4*x),x);
x = 7;
y = 5;
subs(r)

Wayne
ekrem
2011-05-29 11:29:04 UTC
Permalink
Post by Wayne King
Post by ekrem
Hello everyone,
I am trying to evaluate the numerical value of r. It gives the following error.How can I convert r to a double variable?
r = int('a*sin(b*x)')
r =
-(a*cos(b*x))/b
a=3
a =
3
b=4
b =
4
x=7
x =
7
double(r)
??? Error using ==> mupadmex
Error in MuPAD command: DOUBLE cannot convert the input expression into a double array.
If the input expression contains a symbolic variable, use the VPA function instead.
Error in ==> sym.sym>sym.double at 927
Xstr = mupadmex('mllib::double', S.s, 0);
Hi, Are you trying to evaluate your antiderivative at a point? Use subs()
syms x
r = int(3*sin(4*x));
subs(r,7)
Wayne
Hey, thanks a lot!!
Now I got it.

Loading...