Adri van der Meer

Adri vanderMeer

1345 Reputation

16 Badges

14 years, 32 days
University of Twente (retired)
Enschede, Netherlands

My "website" consists of a Maple Manual in Dutch

MaplePrimes Activity


These are replies submitted by Adri van der Meer

@zia9206314 , sorry, Mathtype only converts single LaTeX formulas (i.e. what is placed between $-signs) to Word-formulas. Download a free inspection copy of MathType, and try it yourself.

@Luka "is it that two parameters need two equations in order to do inverse?"
Yes, to find the inverse of a function R2 to R2 means to solve two equations with two unknowns. If the functions are nonlinear, it is nearly always impossible to find explicit solutions. Moreover, almost always there doesn't exist a global inverse.
In your example, there is a solution. Try:

  F := {u=2*x+3*y, x^2+y^3}:
  s := solve( F, {x,y} );
  s1 := allvalues(s);
  remove( has, [s1], I )[];

 

@jjrohal because the current directories may be different on different platforms. You can change the directory by

currentdir("C;/projects");

see ?currentdir
You may also try

kernelopts(homedir);

@Syeda Make the right hand side of eq1 a function:

f := (a,b) -> 1.782005573*a^2+2.483310992*a+1.360919422-3.123062564*10^(-9)*
   sqrt(3.174428983*10^17*a^4+8.847440780*10^17*a^3 + 
     1.461867487*10^18*a^2+1.178106706*10^18*a+1.600992583*10^18*b-1.484747647*10^18):

Now you can apply f on all elements of the lists z1 and z2:

eq1 := x = f~(z[1],z[2]);

@satya123999 

restart;
A := Vector(): i := 1:
while not feof("ConservationEqs.txt") do
A(i) := parse(readline("ConservationEqs.txt"));
i := i+1
end do:

 

@Hypnos I Answered your original question to express the eigenvectors as a function of test10. Apparently you also want the eigenvalues. Well then, change the function to

ev := x -> op(simplify( [Eigenvectors(eval(NewMatrix3,test10=x))], zero ));

That neans: calculate the eigenvalues and eigenvectors of NewMatrix3 for test10=x. Now

EVls, EVcts := ev(4.73);

gives you the vector of eigenvalues and the matrix with the corresponding eigenvectors as columns for test10=4.73:

EVcts.DiagonalMatrix(EVls).EVcts^(-1);

returns the original matrix NewMatrix3 (with test10=4.73 of course). Instead of 4.63 you can choose every value for test10 that you want!

 

@adel-00 you only ave to change the range for u in the fsolve command.

@taro yamada You are not distinguishing between q as a (continuous) function or a Vector (or an Array, because you start with q[0]). If q is a function, then q(t) denotes the value of q(x) at the point x=t, which is a number, so it cannot be used as a variable in differentiation. Even if q is an undefined function, q(t) will be interpreted as a number, not a variable.

 v := 3*q(i)^2 + sqrt(q(i)):
diff(v,q(i));
Error, invalid input: diff received q(i), which is not valid for its 2nd argument

If q is an Array, the i-th entry is denoted by q[i]. An Array can contain all sorts of things, for instance variables. In your last sentence you suggest that u is a finite sum, so I interpret that you use an Array, and the "integral" is a finite sum. Of course you may formulate this as an integral of a piecewise constant function.

Having understood this at last, the solution of your problem is probably:

restart;
v := M -> add( q[i]^2, i=0..M )^2: # upperbound of the sum as a variable
v(5);
                                                       2
        /    2       2       2       2       2       2\
        \q[0]  + q[1]  + q[2]  + q[3]  + q[4]  + q[5] /
# Note that i is not in the expression
dv := (i,M) -> diff(v(M),q[i]):
dv(2,5); # derivative of v(5) w.r.t. q[2]
       /    2       2       2       2       2       2\     
     4 \q[0]  + q[1]  + q[2]  + q[3]  + q[4]  + q[5] / q[2]
# And for example you can do things like
add( dv(i,5), i = 1..3 );
    /    2       2       2       2       2       2\     
  4 \q[0]  + q[1]  + q[2]  + q[3]  + q[4]  + q[5] / q[1]

         /    2       2       2       2       2       2\     
     + 4 \q[0]  + q[1]  + q[2]  + q[3]  + q[4]  + q[5] / q[2]

         /    2       2       2       2       2       2\     
     + 4 \q[0]  + q[1]  + q[2]  + q[3]  + q[4]  + q[5] / q[3]

But when you insist to formulate q as a function and the sum as an integral, you must create it as a piecewise constant function:

restart;
fq := t -> piecewise( t<0, undefined, seq( [t<i,q[i-1]][], i=1..5 ), 0 ):
v := int( fq(t)^2, t=0..5 )^2;
                                                   2
            /    2       2       2       2       2\
            \q[0]  + q[1]  + q[2]  + q[3]  + q[4] /
diff(v,q[2]);
           /    2       2       2       2       2\     
         4 \q[0]  + q[1]  + q[2]  + q[3]  + q[4] / q[2]
Example:
q := Array(0..4, [1,3,5,2,7]):
plot( fq, -1..6 );

Yamada.mw

@taro yamada If q is supposed to be a vector, with elements q[i], i=0,1,2,...,M, what do you mean with Int(q(i),i-0..M) ? Perhaps something like Sum( q[i], i=1..M )? And w.r.t. which variable you want to differentiate this expression?

But maybe q(i) is a function, and you only intend to apply the Fundamental Theorem of Calculus? In that case you can better use indefinite integrals:

v := Int( q(i)^2, i )^2;
diff(v,i);

but this also gives another answer than you expect.

@digerdiga 

f := x -> ln(x)*sin(x):
f(R(200));
                   16.004087585363145
# or eventually:
g := t -> ln(R(t))*sin(R(t)):
g(200);
                   16.004087585363145

@litun ...because "from 1" is default in a ?for loop. "for i from 1 to 50" is also correct.

Besides, a list can directly be constructed by

A := [seq( mul( s[j]/(s[i]-s[j]), j=remove( n->n=i, L ) ), i=1..50 )]:

@Gaia I don't understand the purpose of your manipulations. Perhaps you mean to find the inverse of a coordinate transformation? In that case this is a slightly modified example:

test5 := subs(y=-q/p^2, subs(x=-q/p, x+y));
s := solve( {y=-q/p^2, x=-q/p}, {p,q} );
subs(s, test5);
                             x + y

Your initial example doesn't work, because x and y are both transformed to the same function:

 test5 := subs(y=-q/p, subs(x=-q/p, x+y)):
solve( {y=-q/p, x=-q/p}, {p,q} );
                         {p = 0, q = 0}

@Gaia Actually I did it by hand. But perhaps you could generalize something like

s := y = test4/coeff( test6, y );
subs( s, test6 );

@litun I made your equations symbolic:

restart;
Bstar := 36/10/(12+s)+14/(20+s):
Nrot := <a-q*I,a+q*I,c,d-e*I,d+e*I,f>:
rfw := unapply(product(-Bstar*gm[i]+1, i = 1 .. 6), s):
for i to 6 do b[i] := rfw(Nrot[i]) end do:

Now we still get a lot of solutions:

s := solve({b[1] = 0, b[2] = 0, b[3] = 0, b[4] = 0, b[5] = 0, b[6] = 0}, 
     {gm[1], gm[2], gm[3], gm[4], gm[5], gm[6]} ):
nops([s]);
                              100

I add all components of each solution and make a set of all these sums:

m := { seq(simplify( eval( add(gm[i],i=1..6), s[j] ) ), j=1..nops([s]) ) }:
nops(m);
                               1

This set contains only one element, so each solution sums up to the same value (not equal to 1).

@Preben Alsholm Of course, your solution is (again) simpler than mine.

1 2 3 4 5 6 7 Last Page 2 of 11