tomleslie

13821 Reputation

20 Badges

14 years, 214 days

MaplePrimes Activity


These are answers submitted by tomleslie

Do you have something against fsolve which, for your example returns solution x1=6.000000000, x2=1.000000000, x3=-4.000000000?

If you want to use the Gauss-Seidel method for teaching/learning purposes, then you should be aware that it only works for linear equations, so is not appropriate for you example

If you still want to use the Gauss-Seidel method on a different (linear) example, then check out the Maple help page

?Student[NumericalAnalysis][IterativeApproximate]

One of the options available for the 'IterativeApproximate' command is to set method=Gauss-Seidel

Don't understand the issue you have with Carl's response, because when I try, it works just fine.

If you want another (less elegant) solution, try the attached

Pimat.mw

Well, in your worksheet Vr i a function of two variables r and theta - so you need to plot in 3D

As drawn, the vertical scale of your plot is completely dominated by the values as r->0 when Vr-> infinity. You might want to consider restricting the vertical range using the plot option/view

You might also consider the option coords=cylindrical

Not sure why you want a "recursive procedure" for this problem unless it is for teaching/learning pruposes.

Ignoring the "recursive" requirement there are many ways to achieve what you want, depending on whether you would like a user-defined error message, or are happy to receive a Maple-generated error message.

See the attached file for a few options

dectoBin.mw

If I force a numerical evaluation of your final integral using

evalf
( int
  ( exp(-.3872983346*r*(2.*r-2.))/(r*HeunB(0., -.8801117368*I, -.1936491673, 0., (.8801117368*I)*r)^2),
    r = 0..1
  )
);

then Maple returns Float(infinity)

If I plot the integrand over the integration range 0..1 using

plot
( exp(-.3872983346*r*(2.*r-2.))/(r*HeunB(0., -.8801117368*I, -.1936491673, 0., (.8801117368*I)*r)^2),
   r = 0 .. 1
);

then it *seems* reasonably obvious that the integrand heads to infinity as r->0.

Given the expression(s) which you have entered, should Maple return infinity - probably yes, and I don't know why it doesn't. Either way I don't think you are going to have much luck evaluating these integrals, because the answer always seems to be infinite, and I'm pretty sure that is not what you want

Like this

X:=[2, 3, 5, 9]:
Y:=[7, 5.0, 2, 11]:
evalf(add( X[i]*ln(Y[i]), i = 1..numelems(X)));

Too many errors/typos in your original code to list them all
Suggest you read the attached very carefully - It is *close* to what I *think* you want

 

RiSum.mw

Don't really need the square bracket suggestion. Solve will produce a sequence (which is an indexable entity) so solutions can be selected using a[i] where i is a number from 1..3.

Or if you only want real solutions then use RealDomain[solve]

See the attached (slightly revised) worksheet

CS2.mw

 

SO many things I wouldn't do this way - such as having text in matrices, keys as a set not a list, etc, etc - but if you just want the quick dirty answer, try

 

m:=< <"foobar"  | 77>,
     <"faabar"  | 81>,
     <"foobaa"  | 22>,
     <"faabaa"  | 8>,
     <"faabian" | 88>,
     <"foobar"  | 27>,
     <"fiijii"  | 52>>:
keys:={"foo", "faa"};
< seq( < j | add( `if`(m[i,1][1..3]=j,  m[i][2] ,0), i=1..7)>, j in keys) >;

Or you could play with

restart:
with(Student[Calculus1]):
f:= x -> piecewise( x<0, -(x^2) ,0<=x, x^2) ;
MeanValueTheorem(f, -2..2);

Assuming you have two lists, the first (L1) has elements [x1i, y1i], i=1..n the second (L2) has elements, [x2i, y2i], i=1..n and you want a third list (L3) with elements [x3i, y3i], i=1..n, where x3i=x1i and y3i=y1i*y2i, then all that is required is

L3:= [seq( [L1[j][1], L1[j][2]*L2[j][2]], j=1..numelems(L1))];

The first part of your question can be considered as Maple-specific: the code


restart;
with(LinearAlgebra):
A:= Matrix([ [a, a-1, -b],
                  [a-1, a, -b],
                  [b, b, 2*a-1]
               ]);
algsubs( b^2=2*a*(1-a), Transpose(A).A );


results in an identity matrix which demonstrates that you have a rotation matrix - although you should consider why AT*A=I implies that A is a rotation matrix!

The second part of your question is an *understanding* problem which is not Maple-specific. I suggest you type something like "find rotation axis from matrix" into your favourite search engine and read almost any of the results

Try

M:=Array([seq( [seq( i+j, j=1..5)], i=1..5)]);

Never use [] to produce an "inert" subscript:

a[0] will "print" as a0 but it actually defines the zeroth element of the indexable quantity a ( an implicitly defined table)- which is probably not what you want.

If you just want something which prints as a0 but has no implication of an indexable quantity, then you should use a__0 (that's two underscores).

Check what is printed and consider the difference between

restart:
a:=1:
a[0]:=2:
a;
op(a);

and

restart:
a:=1:
a__0:=2:
a;
op(a);

The first of these assigns a:=1 as expected but the statement a[0]:=2 implicitly defines a table called a with a single indexed value (index 0) such that a[0]:=2 - this "overwrites" the original statement a:=1

 

The second of these just defines two scalar (ie non-indexable) symbols called a and a0 which are completely unrelated to each other

 

If you want all possible products of primes in your list (with each prime occurring only once in any product) then you could try

restart:
L:=[2,3,5,7,11,13,17,23,29,31,37,43,47]:
prods:=sort([seq(mul(j, j in q), q in combinat[choose]( L )[2..-1])]);

First 203 204 205 206 207 Page 205 of 207