Rouben Rostamian

MaplePrimes Activity


These are answers submitted by Rouben Rostamian

restart;
f := x -> 2*2^x-2;
g := x -> -1/2*x^2+3/2+5;
fsolve(f(x)=g(x), x=-10..10, maxsols=2);
                -4.094614685, 1.787210719

 

This problem can be solved by hand with the method that I described in my yesterday's answer to another question.  The solution turns out to be

which you may verify by direct substitution.  I don't have the time this evening but I should be able to post the details that lead to that solution tomorrow.

=============

OK, it's tomorrow now, and here is the calculation that led to the result above.

Download poisson-problem-on-disk.mw

 

This problem may be solved through Fourier series. Maple can help with some of the calculations but much of the infrastructure needs to be calculated by hand.  The document attached at the bottom of this reply explains the general strategy and then produces the specific solution of the problem that you have posed.

Taking only 8 terms in the Fourier series produces a symbolically exact solution to the PDE which satisfies the boundary condition approximately with a residual error of O(10−7), which is quite good.  Here is the graph of the solution.


Documentation: poisson-problem-with-robin-boundary-conditions.pdf

 

A boundary value problem does not necessarily have a solution. Yours appears to be in that category. If, however, you have some flexibility in choosing the parameter values, then solutions do exist.

Here, in addition to your parameters t3, R, and M, I have introduced two new parameters—the length of the interval, L, and the value of G(0), d.  For instance, setting L=1 and d=0.9 results in a solution as shown below.  Another possible pair is L=0.6, d=1.

restart;
eq1 := diff(F(x), x$4) +2*R*(F(x)*diff(F(x), x$3) + G(x)*diff(F(x),x)) + 2*R*t3*(2*diff(F(x), x$2)*diff(F(x), x$3) + diff(F(x), x)*diff(F(x), x$4) + 3*diff(G(x), x)*diff(G(x), x$2)) = 0;
eq2 := diff(G(x),x$2) - 2*R*(diff(F(x),x)*G(x)- F(x)*diff(G(x), x)) - 2*R*t3*(diff(F(x),x$2)*diff(G(x),x) - F(x)*diff(G(x), x$2) ) = 0;
ic := F(0)=0,  F(L)=0, G(0)=d, G(L)=0, D(F)(0)=0, D(F)(L)=M;
params := t3=2, R = 0.5, M =0.5, L=1.0, d=1.0;   # original (bad choices)
params := t3=2, R = 0.5, M =0.5, L=0.6, d=1.0;   # good choices
params := t3=2, R = 0.5, M =0.5, L=1.0, d=0.9;   # another set of good choices
sys := eval({eq1,eq2,ic}, {params}):
dsol := dsolve(sys, numeric, method=bvp[middefer]);
plots:-odeplot(dsol, [[x,F(x)],[x,G(x)]], color=[red,blue]);

Maple produces the general solution with a little help.

restart;
kernelopts(version);
   Maple 2021.1, X86 64 LINUX, May 19 2021, Build ID 1539851

ode:=diff(y(x),x) = 2*(2*y(x)-x)/(x+y(x));
dsolve(ode, implicit);      # solve
subs(_C1 = ln(C), %):       # replace _C1 by ln(C)
(exp@lhs = exp@rhs)(%):     # exponentiate both sides
simplify(%);

Then you can determine C by applying the initial condition.

Since you are composing procedures, it would make life easier if each f[i] received a procedure and returned a procedure.  Here is how to do it. 
 

restart;
kernelopts(assertlevel=2):

f[1] := proc(x::procedure)::procedure;
	piecewise(0 <= t and t <= 1/2, (1/2)*x(2*t), 1/2 < t and t <= 1, 1/2*x(2*t-1));
	unapply(%, t);
end proc:

f[2] := proc(x::procedure)::procedure;
	t*x(t);
	unapply(%, t);
end proc:

# Illustration
L := [1,2,1]:
map(i->f[i], L):
`@`(%[]):
h := %(t->t^2);   # change t->t^2 to anything else, as needed

plot(h(t), t=0..1);

Download mw.mw

restart;
with(Physics):
alias(x=x(t),y=y(t)):
phi := [ x, phi__1(x,y) ]:
J := < diff(phi[1], x), diff(phi[1], y);
       diff(phi[2], x), diff(phi[2], y) >;

 

This problem is hardly different from the one that you posted a few hours ago. Here is the same answer with minor modifications.

restart;

f := x-> (x^2 - 4*x)/(x^2 - 4*x+3);

proc (x) options operator, arrow; (x^2-4*x)/(x^2-4*x+3) end proc

p1 := plot(f(x), x=-2..6, discont, scaling=constrained, view=-3..7, color=blue);

f is symmetric about the line x = 2

is( f(x+2) = f(-x+2) );

true

Therefore, the center of the circle lies on the line x = 2. The circle touches

the graph at 2, 4, and consequently, the y coordinate of its center is 4-R,
where R is the radius. We conclude that the circle's equation is

C := (x-2)^2 + (y-4+R)^2 = R^2;

(x-2)^2+(y-4+R)^2 = R^2

We calculate the points of intersection of the circle and the graph of f:

xy := solve({C, y=f(x)}, [x,y]);

[[x = 2, y = 4], [x = RootOf(_Z^4-8*_Z^3+(-6*R+31)*_Z^2+(24*R-60)*_Z-18*R+45), y = (1/3)*RootOf(_Z^4-8*_Z^3+(-6*R+31)*_Z^2+(24*R-60)*_Z-18*R+45)^2-2*R-(4/3)*RootOf(_Z^4-8*_Z^3+(-6*R+31)*_Z^2+(24*R-60)*_Z-18*R+45)+5]]

Let us isolate the argument of the RootOf:

select(has, xy, RootOf):
eval(x, %[]):
P := op(1, %);

_Z^4-8*_Z^3+(-6*R+31)*_Z^2+(24*R-60)*_Z-18*R+45

The quartic polynomial P has 4 roots in general, but when the

circle is tangent to the graph of f,  those 4 roots to collapse

into 2 roots.  That happens when the discriminant of the quartic

is zero.

discrim(P, _Z) = 0;
solve(%);

124416*R^5-725760*R^4+1306368*R^3-694656*R^2+38880*R+32400 = 0

-1/6, 1/2, 1/2, 5/2, 5/2

We conclude that the radius is 5/2 and y coordinate of its center is 4 - 5/2 = 3/2.

Here is its graph

plots:-display(p1, plottools:-circle([2,3/2], 5/2, color=red));

 

 

 

Download mw.mw

 

vv has already provided a solution. Here is an alternative approach.

restart;

f:=x->1/(x^2-2*x);

proc (x) options operator, arrow; 1/(x^2-2*x) end proc

p1 := plot(f(x), x=-3..5, discont, view=-3..3, scaling=constrained, color=blue);

f is symmetric about the line x = 1

is( f(x+1) = f(-x+1) );

true

Therefore, the center of the circle lies on the line x = 1. The circle touches

the graph at 1, -1, and consequently, the y coordinate of its center is R-1,
where R is the radius. We conclude that the circle's equation is

C := (x-1)^2 + (y-R+1)^2 = R^2;

(x-1)^2+(y-R+1)^2 = R^2

We calculate the points of intersection of the circle and the graph of f:

xy := solve({C, y=f(x)}, [x,y]);

[[x = 1, y = -1], [x = RootOf(1+_Z^4-4*_Z^3+(-2*R+5)*_Z^2+(4*R-2)*_Z), y = -RootOf(1+_Z^4-4*_Z^3+(-2*R+5)*_Z^2+(4*R-2)*_Z)^2+2*R+2*RootOf(1+_Z^4-4*_Z^3+(-2*R+5)*_Z^2+(4*R-2)*_Z)-1]]

Let us isolate the argument of the RootOf:

select(has, xy, RootOf):
eval(x, %[]):
P := op(1, %);

1+_Z^4-4*_Z^3+(-2*R+5)*_Z^2+(4*R-2)*_Z

The quartic polynomial P has 4 roots in general, but when the

circle is tangent to the graph of f,  those 4 roots collapse

into 2 roots.  That happens when the discriminant of the quartic

is zero.

discrim(P, _Z) = 0;
solve(%);

512*R^5-768*R^4-768*R^3+640*R^2+672*R+144 = 0

3/2, 3/2, -1/2, -1/2, -1/2

We conclude that the radius is 3/2 and therefore the y coordinate of its center is 1/2.

Here is its graph

plots:-display(p1, plottools:-circle([1,1/2], 3/2, color=red));


 

 

 

Download mw.mw

 

In your worksheet you have
motioneq  = (3.2)

That "=" should be ":=".

I know nothing about MapleSim, so I cannot help you in that respect.

 

 

 

Unless you have a very ancient version of maple, this should do what you want:

int~(<sin(x), cos(x)>, x=0..2);

I can think of a dozen or two different answers to your extremely vague question and it's likely that they will be unsatisfactory as long as you refuse to show your code. Anyway, here is one possibility:

restart;

E := phi -> 1 / (1+phi^2);

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

E(0.4);

.8620689655

plot(E(phi), phi=0..1);

 

 

 

 

Download mw.mw

Based on the information that you have provided, this is all that we can do:

restart;

de := diff(x(t),t) = A(t)*x(t) + B(t)*u(t);

diff(x(t), t) = A(t)*x(t)+B(t)*u(t)

dsol := dsolve(de, x(t));

x(t) = (Int(B(t)*u(t)*exp(-(Int(A(t), t))), t)+_C1)*exp(Int(A(t), t))

y(t) = eval( C(t)*x(t) + E(t)*u(t), dsol);

y(t) = C(t)*(Int(B(t)*u(t)*exp(-(Int(A(t), t))), t)+_C1)*exp(Int(A(t), t))+E(t)*u(t)

If that's not what you want, then you will have to be more specific about what you are looking for.

 

restart;

x := [x__1,y__1,theta__1,x__2,y__2,theta__2];

[x__1, y__1, theta__1, x__2, y__2, theta__2]

f := [cos(theta__1),sin(theta__1),0,0,0,0];

[cos(theta__1), sin(theta__1), 0, 0, 0, 0]

J := Matrix(6, 6, (i,j) -> diff(f[i], x[j]));

Matrix(6, 6, {(1, 1) = 0, (1, 2) = 0, (1, 3) = -sin(`#msub(mi("&theta;",fontstyle = "normal"),mi("1"))`), (1, 4) = 0, (1, 5) = 0, (1, 6) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = cos(`#msub(mi("&theta;",fontstyle = "normal"),mi("1"))`), (2, 4) = 0, (2, 5) = 0, (2, 6) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0, (3, 4) = 0, (3, 5) = 0, (3, 6) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 0, (4, 5) = 0, (4, 6) = 0, (5, 1) = 0, (5, 2) = 0, (5, 3) = 0, (5, 4) = 0, (5, 5) = 0, (5, 6) = 0, (6, 1) = 0, (6, 2) = 0, (6, 3) = 0, (6, 4) = 0, (6, 5) = 0, (6, 6) = 0})

 

Download mw.mw

 

Here are two different ways to achieve that.

Method 1: Use the EulerLagrange function in the VariationalCalculus package:

VariationalCalculus:-EulerLagrange(L, t, [ x(t), y(t), alpha(t), phi1(t), phi2(t) ] );
remove(type, %, equation);

Method 2: Load the Physics package:

with(Physics):

That redefines diff so that your code should work unless you have other errors in it.

There are other ways as well but the two that I have shown here are the quickest. 

In the future, when you ask a question, include your actual Maple worksheet.  Showing just a picture, as you have done, is not very helpful since I cannot execute that code to test my suggestions before replying.

 

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