Items tagged with eval eval Tagged Items Feed

Hello people in mapleprimes,

 

I wonder if there is not any way to control the timing of substitution.

For  example,

x:=(t^(1-s)+s^(1-2*s))^a;mu:=c^(a-b)/'x';

brings mu := c^(a-b)/x. Please note that I made x unevaluated with '' around x, so that,

into the output of mu, the definition of x of (t^(1-s)+s^(1-2*s))^a does not appear.

But, in this case, when I typed the expression of

1+mu

and clicked return, the definition of x is inserted into the result of 1+m, though

I want x to remain x yet.

Surely, if I wrote ''x'' in stead of 'x', 1+mu does not contain the definition of x.

But, in that case as well, when I have other following calculations, in those the definition 

of x should apear, which I don't like.

 

On the other hand, when I write as

x:=(t^(1-s)+s^(1-2*s))^a; x:='x';
mu:=c^(a-b)/x; 1+m;

surely as x is initialized once, the result of mu and 1+mu does not cotain the definition of x.

But, in this case, I have to write x:=(t^(1-s)+s^(1-2*s))^a; when I want the definition of x

to be inserted. Though in this case the definition of x is short, original relations I have and

haven't writen above is a little more complicated, so that to insert is not desiable.

 

Aren't there any good way to evaluate the value of particular variables and to leave them

unevaluated at each time I want to choose each one?

 

I hope I could have written my question as easly understood.

And, thanks in advance.

 

taro

 


                           

 

Why can't I sub both values at the same time and/or why does k stay symbolic but not d?

Hi everybody

In the following attached file, I try to evaluate an integration, K_fL. Unfortunately, Maple does not evaluate it and just puts integration symbol and its bounds. I want to have final integration value. Is there any solution to this integration or maybe Maple can not solve this integration because of the complexity of integrand?

Thanks in advance

Q1.mw

After running Maple in a shell file, I come up with this error that I do not understand on my Mac,

gap_long := 0.117647058823529 Pi

gap_lat := 0.0588235294117647 Pi

lat_begin := 0.441176470588235 Pi

long_begin := -Pi

lat_begin_0 := 0.441176470588235 Pi

long_begin_0 := -Pi

long_max := 0.882352941176471 Pi

lat_max := -0.441176470588235 Pi

33

Warning, `parameter` is implicitly declared local to procedure `set_par_eff`

distance eff distance_eff
im in has not
im in has not
im in has not
im in has not
im in has not
im in has not
im in has not
im in has not
im in has not
Im in has par
Im in has par
Error, invalid input: eval expects its 2nd argument, eqns, to be of type
{integer, equation, set(equation)}, but received par_eff_post
13

32

31

17

hou := 0

mini := 0

seci := 0

memory used=4.0MB, alloc=32.3MB, time=0.23



If needed, I can attach more files if my question is still a bit too cryptic. Please let me know asap as this is urgent. Thank you so much,
-Z

Hello,

I need to crate a function to be evaluated in a range of values, and this function i would to use in other expression, example:

cel1      "seq(i,i=0.001..2,0.001)"

cel2      "A:=&1";cel1

cel3      "f:=x->diff(KelvinBei(0,x),x)"

cel4      ""B:=map(x->f(x),[A])"

 

This is ok with a lot of function but with diff(KelvinBei(0,x),x) in cel4 show this error "Error,(in f) invalid input:.1e-2, which is not valid for its 2nd argument.

Why??? How can I do??

Hello guys,

I was just playing around with the Shanks transformation of a power series, when I noticed that polynomials aren't evaluated as I would expect.
I created this minimal working example; the function s should evaluate for z=0 to a[0], however it return simply 0.
Is there something I messed up?

restart

s := proc (n, z) options operator, arrow; sum(a[k]*z^k, k = 0 .. n) end proc;

proc (n, z) options operator, arrow; sum(a[k]*z^k, k = 0 .. n) end proc

(1)

series(s(n, z), z = 0)

series(a[0]+a[1]*z+a[2]*z^2+a[3]*z^3+a[4]*z^4+a[5]*z^5+O(z^6),z,6)

(2)

The value of s in z=0 should be a[0], however it returns 0:

s(n, 0)

0

(3)

s(1, 0)

0

(4)

Download evaluate_sum.mw

 

Thanks for your help,

Sören

Hey all,

I want to symbolically differentiate a function and recalculate the result later. Here is what I have tried so far:


restart;

myexp:=dfdb+sthlong

dfdb+sthlong

(1)

b:=<b1(t),b2(t)>;

b := Vector(2, {(1) = b1(t), (2) = b2(t)})

(2)

dfdb:=Physics[diff]~(f(b),b)

dfdb := Vector(2, {(1) = (D(f))(Vector(2, {(1) = b1(t), (2) = b2(t)})), (2) = (D(f))(Vector(2, {(1) = b1(t), (2) = b2(t)}))})

(3)

f:=b->b(1)^2+b(2)

proc (b) options operator, arrow; b(1)^2+b(2) end proc

(4)

eval(myexp);  #actual result

 

 

sthlong+(Vector(2, {(1) = (D(f))(Vector(2, {(1) = b1(t), (2) = b2(t)})), (2) = (D(f))(Vector(2, {(1) = b1(t), (2) = b2(t)}))}))

(5)

dfdb:=Physics[diff]~(f(b),b):

eval(myexp); #expected result

sthlong+(Vector(2, {(1) = 2*b1(t), (2) = 1}))

(6)

 


Download physics_diff.mw

I wonder if this is even possible, or if I missunderstand something. Can you please help me?

 

Thanks

 

Honigmelone

Consider the following:

conv1 := (x) -> eval(x, tau*f(t) = f(-t)):     # Using eval
conv2 := (x) -> algsubs(tau*f(t) = f(-t),x):   # Using algsubs
expr := Vector([
     tau*f(t),
   I*tau*f(t)
]);
conv1(expr),
conv2(expr);

I would have expected both components of expr to have been transformed, just as they do if algsubs is used, but the second component containing the imaginary unit I as well is not. Why not? Note that if I is replaced by any real number, then the substitution works quite as expected. Why should going from real to complex numbers change things fundamentally?

Additional note: Even though algsubs works above, I would like to avoid using it because the actual system I have contains more than a hundred substitutions to (potentially) be made, and algsubs can only take one at a time, in constrast to eval which in principle can take indefinitely (though finitely, of course) many at a time.

PS: In case the reader is wondering, tau is supposed to be a time reversal operator acting on some time-dependent function f(t).


Why does "eval(c, [b=1,l=1])" turn out to be "1" not "1/1+x"??? its driving me cracy. THX

restart

 

a:=(1/(1+x/l))

1/(1+x/l)

(1)

eval(a, [l=1])

1/(1+x)

(2)

eval(a, [x=2,l=1])

1/3

(3)

c:=(1/b(1+x/l))

1/b(1+x/l)

(4)

eval(c, [b=1,l=1])

1

(5)

 



 

Dear all,

Thank you for helping me  to generate a table of values of f(x) starting with x=0 to 100 in steps of 1, that is for x=0,1,2,3,...,100.

 

I tried:

f:=x->2*sqrt(3)*a1*a2*(sum(pochhammer(1/3,k)*3^k*x^(3*k)/(3*k)! ,k=0..infinity)*sum(pochhammer(2/3,k)*3^k*x^(3*k+2)/(3*k+2)!  ,k=0..infinity)-sum(pochhammer(2/3,k)*3^k*x^(3*k+1)/(3*k+1)!  ,k=0..infinity)*sum(pochhammer(1/3,k)*3^k*x^(3*k+1)/(3*k+1)!  ,k=0..infinity));

tab_values:=[evalf(simplify(seq(Ni1(xx),xx=0..100)))];

But I the result is amazing.... I don't understand the problem.

Thanks

 

Hi

If I have this equation

and I need to use different Z, it's like

how can I solve it

Many Thanks

Amal

So I am using the with(Student[MultivariateCalculus]); package to find the maximum and minimum of the fumction xyz to the given constraint: LagrangeMultipliers(x*y*z, [x^2+4*y^2+4*z^2-4], [x, y, z]) and I got 14 points. But to find the global maximum/minimum I need to evaluate all these points in the main function xyz. I tried converting it to a list and doing something and checked out this thread but it's only for single variable stuff so I am not sure how to extrappolate it to my case.

http://www.mapleprimes.com/questions/202529-Evaluating-A-Function-At-More-Than-One-Point#

These were my points by the way, Yeah lots.

[0, 0, 1], [0, 0, -1], [0, 1, 0], [0, -1, 0], [2, 0, 0], [-2, 0, 0], [(2/3)*sqrt(3), (1/3)*sqrt(3), (1/3)*sqrt(3)], [-(2/3)*sqrt(3), -(1/3)*sqrt(3), -(1/3)*sqrt(3)], [(2/3)*sqrt(3), (1/3)*sqrt(3), -(1/3)*sqrt(3)], [-(2/3)*sqrt(3), -(1/3)*sqrt(3), (1/3)*sqrt(3)], [(2/3)*sqrt(3), -(1/3)*sqrt(3), (1/3)*sqrt(3)], [-(2/3)*sqrt(3), (1/3)*sqrt(3), -(1/3)*sqrt(3)], [(2/3)*sqrt(3), -(1/3)*sqrt(3), -(1/3)*sqrt(3)], [-(2/3)*sqrt(3), (1/3)*sqrt(3), (1/3)*sqrt(3)]

I have this two matrices

uA := Matrix([[-w^2+x^2+y^2-z^2, -2*(w*y+x*z), 2*(-w*x+y*z)], [2*(-w*y+x*z), w^2+x^2-y^2-z^2, -2*(w*z+x*y)], [2*(w*x+y*z), 2*(-w*z+x*y), -w^2+x^2-y^2+z^2]])

and

 

UA := eval(uA, {w = -w, x = -x, y = -y, z = -z})

 

and I want to check that their are the same. I have tried

evalb(uA = UA)

 

but it says it false. It should say that is true, because - I think- this two matrices are the same.

Does anyone know what is wrong?

 

Many thanks

I have y"+y=sinx

If I want to substitute y=sinx, how should I do it?

I tried subs(y=sin(x),f(y))(ofc after defining f:=y as above).

The most troubling thing is that it does not automatically apply double derivative.

HI there,

I m getting an error message . Could someone help me

 

v1 := int(cos(tau)*g(tau), tau = t0 .. t);
int(cos(tau) g(tau), tau = t0 .. t)
v2 := int(-sin(tau)*g(tau), tau = t0 .. t);
int(-sin(tau) g(tau), tau = t0 .. t)
soln := C1*y1+C2*y2+v1*y1+v2*y2;
C1 y1 + C2 y2 + (int(cos(tau) g(tau), tau = t0 .. t)) y1

+ (int(-sin(tau) g(tau), tau = t0 .. t)) y2
soln := combine(soln);
(int(-y2 sin(tau) g(tau) + y1 cos(tau) g(tau), tau = t0 .. t))

+ C1 y1 + C2 y2
eval(soln, t = t0) = 0, eval(diff(soln, t), t = t0);
C1 y1 + C2 y2 = 0, -y2 sin(t0) g(t0) + y1 cos(t0) g(t0)
solve({%}, {C1, C2});
soln := eval(soln, %);
Error, invalid input: eval received (C1*y1+C2*y2 = 0, -y2*sin(t0)*g(t0)+y1*cos(t0)*g(t0)), which is not valid for its 2nd argument, eqns

 

1 2 3 4 5 6 Page 1 of 6