Jarekkk

454 Reputation

13 Badges

19 years, 247 days

MaplePrimes Activity


These are answers submitted by Jarekkk

I'm not sure if I understand correctly your question, but here are some suggestions:

1) If you want the computed variables to be assigned after solving with solve you can type:

solve({E||(1 .. 8)}, {C||(1 .. 8)});
assign(%);

2) But you probably want to store whole equalities to new variables X1,...,X8, which can be done by:

X||(1..8):=op(solve({E||(1 .. 8)}, {C||(1 .. 8)}));


Edit: I assumed the solve command returns exactly one solution. Otherwise it would be more complicated. I still don't understand why you want such a thing, since in my opinion it is better to use just one variable to store all the solutions like

sol:=solve({E||(1 .. 8)}, {C||(1 .. 8)});

Look at ?coeffs. You can use e.g.:

eq := A*x*y*z+B*x*y^2*z^2+C*x^2*y*z^2+D*x*y*z^2+E*z+F = G*x*y+H*x*y^2+M*x^2*y+P:

zip(`=`, [coeffs(lhs(eq), [x, y])], [coeffs(rhs(eq), [x, y])]);


Edit:

This is more general:

zip(`=`, [coeffs(lhs(eq)-rhs(eq), [x, y], 't')], [seq(0, i = 1 .. nops([t]))]);

The previous command works just because there are the same terms on each side. So it is better to put everything on the same side of the equation and then divide it to individual terms.

int(sin(n*Pi*t/L)*sin(m*Pi*t/L), t = -L .. L) assuming m::integer, n::integer, m <> n;

I am not an expert in fractals, but I would say:

If we denote N(n) the number of sides of the n-th square and L(n) the length of one side of the n-th square, then we get (I suppose that the first (n=1) square is the original one):

N(n):=4*(2*3^(n-1)-1);
L(n):=(1/3)^(n-1);

And for the area of the n-th square we get:

A(1)=1:
A(n)=A(n-1)+N(n-1)*L(n)^2:

Then we can also solve the reccurence:

A(n)=rsolve({A(1) = 1, A(n) = A(n-1)+N(n-1)*L(n)^2}, A(n));

and get

What do you mean by programatically? For calculating a determinant you can use the ?LinearAlgebra[Determinant] command. If you don't want to use this command you can transform the matrix into the triangular form (there is also a command for this: ?LinearAlgebra[GaussianElimination]) and then multiply the elements on the diagonal.

You can define the function with:

f := x->2.2*x^5-4.4*x^3+1.3*x^2-0.9*x-4;

To plot it on [-2,-1] you can use the ?plot command:

plot(f,-2..-1);

For the Newton's method you will need the differentiation of f which you can get with ?diff command, e.g.:

f_dif:=unapply(diff(f(x),x),x);

f_dif is now the function of variable x (you can see ?unapply as well).

You may use a "while"-loop (see ?do ).

This can get you started.

Be careful in typing the exponential function. It should be:

exp(x)

but you have there (in assignment to Q)

exp^(x)

I do not get that error, since there is no "solving' command. However, I suppose that you used the solve command, but you have to use the dsolve command (for ordinary differential equations) instead.

Look at ?Statistics[Fit].

Statistics[Fit](A+B1*exp(-t/C1)+B2*exp(-t/C2), X, Y, t);

should be what you're looking for.

You can print some info with setting the ?infolevel to 5 for example (infolevel[solve]:=5). The solve command can't find the solution. You can use the ?fsolve command instead (which computes the solution numerically).

 

You have to either not specify the variables or specify them all with a in the solve command. It has the solution only for a=2 and you can see it e.g. with:

solve({eq1, eq2, eq3, eq4, eq5});

Or if you want to say that a is a parameter then you can type:

solve({eq1, eq2, eq3, eq4, eq5}, {s, t, x, y, z}, 'parameters' = {a});

or

solve({eq1, eq2, eq3, eq4, eq5}, {s, t, x, y, z}, 'parametric'='full', 'parameters' = {a});

As you can read from the error message you need to add another boundary condition. There are only 5 bcs, but dsolve expects 6 bcs. Maybe f(10)=something in bcs1 is missing.

OK, I made some changes and added also a little different way to produce the plots, since your code takes a lot of time. I will add some comments later.

Polygon_Problem_chan.mw

Can you work with components and edit their properties? I created an example using them, so you can look whether this is what you want.

example_epidemic.mw

M := Matrix(2, [[Pi, exp(1)], [sqrt(2), sqrt(3)]]);

evalf(M);


M := Matrix(2, [[x, x+y], [x*y, y]]);


eval(M, x = 2);


2 3 4 5 6 7 Page 4 of 7