## 6953 Reputation

10 years, 249 days

## A few issues...

1. I'm assuming that the 'grad' functions refers to the depreated linalg[grad] command, so need to load the (deprecated) linalg package
2. OP's procedure doesn't return anything meaningful, because it defines globals C1, C2, C3, V1, V2, V3 and then assigns values to C[1], C[2}, C[3], V[1], V[2], V[3] - fixed this by assigining to C||j (ie cat the names)
3. To use spacecurves need with(plots)
4. Worksheet now runs (in Maple 2015) and produces plots (see attached), although I'm not sure that these are very interesting (I have no way of knowing)

plotProb.mw

## Hmmm -inconsistent...

Your requirements appear to be inconsistent:

your third requirement "K:=2 and m:=3" increments the first index, but

your fourth requirement "K:=1 and m:=4" shouldn't increment the first index, but your posted solution does. I'm assuming that this is a typo.

Assuming that it is a typo, try

restart;
genVec:= (x,y) -> [ seq
(  [ seq
( psi[k,j],
k = 1..x
)
],
j = 0..y-1
)
]:
genVec(1,3);
genVec(1,4);
genVec(2,3);
genVec(2,4);

If this isn't what you want then post requirements in a consistent fashion

1. If you have 9 linear equations with 9 unknowns and numeric coefficients, then I would expect fsolve to breeze through it.
2. If you have 9 non-linear equations with 9 unknowns and numeric coefficients then fsolve might find it a bit harder, but could probably be "persuaded" to work
3. If you have 9 linear equations with 9 unknowns and "algebraic" coefficients, then solve might have difficulty, depending on the algebraic complexity of the coefficients
4. If you have 9 non-linear equations with 9 unknowns and "algebraic" coefficients, then solve will almost certianly have difficulty, particularly if the coefficients are "complicated" algebraic expressions.
5. If you upload a worksheet using the big green up-arrow (right-hand entry in the second row of the toolbar), then you might get some more useful comments

## Example solution...

The attached worksheet "undefines" the spherical coordinate system in the Physics package and then "derives" it from first principles. You ought to be able to use it for any other coordinate system, provided that you know the transformation equations.

curCoor.mw

Remember that (according to the help page for the Physics[Vectors] sub-package)

"the Vectors subpackage is designed to work only with cartesian, cylindrical and spherical orthonormal basis and the related systems of coordinates"

so I advise caution if you are going to define your own coordinate system

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

## Another possibility...

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

## Its 3D...

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

## Several ways to do this...

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

## traverse lists using an index...

Like this

X:=[2, 3, 5, 9]:
Y:=[7, 5.0, 2, 11]:

## So many errors...

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

## Or...

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

## Ugly...

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) >;

## Alternatively...

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 I understand the problem...

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))];

 First 138 139 140 141 142 Page 140 of 142
﻿