## 6252 Reputation

10 years, 110 days

## Several typos...

eg 'plotools' rather than 'plottools', 'trasparenvy' rather than 'transparency'. etc

Try

restart;
plots[display]
( plottools[cuboid]
( [0,0,0],[1,1,1] ),
transparency=.7,
colorscheme= [ "xyzcoloring",
proc(x,y,z)
option operator, arrow;
x^2 + y^2 - z^2
end proc
]
);

## Clarify issue...

In Maple 2015, either of the following produces a plausible answer

restart:
f1 := t -> sin(t);
f2 := t -> cos(t);
dsys := {diff(x(t), t) = x(t)*f1(t)+f2(t), x(0) = 3};
solution_procedure := dsolve(dsys, type = numeric, output = listprocedure);
solution_procedure[2](1);
restart:
f1 := t -> sin(t);
f2 := t -> cos(t);
dsys := {diff(x(t), t) = x(t)*f1(t)+f2(t), x(0) = f1(3)};
solution_procedure := dsolve(dsys, type = numeric, output = listprocedure);
solution_procedure[2](1);

Well apart from the arbitrary constant (which int() never provides), the following works for me

restart;
eqn1:=diff(u(xi), xi,xi)=a__0+a__1*u(xi)+a__2*u(xi)^2;
eqn2:=diff(u(xi), xi)*eqn1:
eqn3:=map(int, eqn2, xi):
isolate(eqn3, diff(u(xi), xi)^2);

It also follows the OP's 'manual' method

## Or...

If you want to do it the "long" way, you will need to know the difference between an equation ('=') and an assignment (':='). The following will work

restart;
a:=178:b:=312:
c:=igcdex(a,b,'e','f'):
14/c*e=x;
14/c*f=y;

## hmmmm...

fsolve really does not like the term ln(-m0) - whihc is complex, and things go downhill from there.

This can be avoided with a little maniplation

restart;
#
# Define equation
#
eqn:=-g*t-vs*ln(r*t-m0)+vs*ln(-m0);
#
# Mnipulate to combine ln() terms
#
eqn:=combine(collect(eqn, vs), ln, 'symbolic');
#
# Assign parameters
#
r:= 13100:
vs:=2550:
g:= 9.81:
m0:= 2.8e6:
#
# Solve for case where eqn=300
# specifying that solution  ar in the range 0..100
#
fsolve(eqn=300, t, 1..100);
#
# Solve for case where eqn=300
# specifying that solution  are in the range -300..0
#
fsolve(eqn=300, t, -300..0);
#
# Plot over the range -300..100
#
plot(eqn, t=-300..100);

## Add two inequalities to the system...

Compare

solve(.3707752782+.1499320455*sin(theta[4](t))+.1117559025*cos(theta[4](t))=0.5,theta[4](t))

with

solve({.3707752782+.1499320455*sin(theta[4](t))+.1117559025*cos(theta[4](t))=0.5,
theta[4](t)>=0,
theta[4](t)<=Pi/2
},
theta[4](t)
);

In the second, only solutions in the range 0..Pi/2 will be returned

## Slightly depnding on Maple version...

Use one of the following

#
# Valid in Maple 2016
#
with(NumberTheory):
Value(ContinuedFraction([1,2]));
Value(ContinuedFraction([1,1,2]));
Value(ContinuedFraction([1,1,1,2]));
#
# Works in previous versions (but is
# 'deprecated' in Maple 2016
#
with(numtheory):
cfrac([1,2]);
cfrac([1,1,2]);
cfrac([1,1,1,2]);

## And other syntax errors!...

As well as the problems with 'implied multiplication'

1. The first argument to plots:-sphereplot() is meaningless
2. plots:-sphereplot() is deprecated. You should be using plot3d() with the option coords=spherical. (Unless you have a very old Maple)
3. You cannot use plots:-fieldplot to plot a 3-D vector field, you need to use plots:fieldplot3d()

See the attached for more detailed explanations/examples

explainPlots.mw

## Some syntax trouble...

I (occasionally) share your confusion with the correct way to apply the output of a dsolve/numeric command as the input of a subsequent command. However the code in the following (if a little clumsy), seems to provide the answers for your pde.

I have incuded a couple of extra plot() commands at the end, to give some idea of the 'scope' of output information which is available

awkwardPDE.mw

1. I am somewhat surprised that no convolve function exists outside the AudioTools and SignalProcessing packages, both of which only accept 'numeric' values. If I had 'numeric' values I would tend to use the latter, if only becuase it accepts simple Arrays as input
2. It is not too difficult to write your own convolution function, as in the attached. A caveat: convolution is one of these functions which can be calculated "efficiently" - or not. The code in the attached is as simple-minded as possible, and as the examples show, works for most "sensible" 1-D data types. Compared with either AudioTools:-Convolution(), or SignalProcessing:-Convolution() it is probably very inefficient. But it does work with (1-D) structures containing symbolic data
3. If you are interested in 2-D convolution, then I suggest you check ImageTools:-Convolution()

convolve.mw

## Many possibilities...

The followng is just one possibility. Note that you will have to change the filePath to something appropriate for your installation

fy:=eval(y(x),dsol5):
#
# Use a sequential formatted print statement
# to write to simple text file
#
fname1:="C:/Users/TomLeslie/Desktop/txtop1.txt": #OP needs to change this
seq
( fprintf
( fname1,
"%12.8f, %12.8f\n",
x, fy(x)
),
x=0..1, 0.1
):
fclose(fname1):

## Double use of the name 'k'...

If I check your worksheets with

1. A loop with 'J' running from 15 to 16
2. A single value of J=16

then the plots for J=16 differ - not by much - but they are different!

So it seems that any time your loop executes for a single 'J-value', the answer is different from the corresponding 'J-value', with the loop performing multiple times.

I traced this behaviour to the fact that you are reusing the value 'k'.

1. It is assigned to 0.524 prior to loop execution
2. So first time through the loop, the above value of 'k' will be used in the computation of omega_e and all subsequent dependent quantities (I assume that this is deliberate)
3. However also first time through the loop, the value of 'k' is reassigned to 1.25, apparently purely for use in plot generation???
4. This means that second time through the loop, the value of 'k' being used in the computation of omega_e wil be 1.25, not 0.524
5. So if you run the loop once with J=16, your answer will be calculated using k=0.524. If you run the loop twice, with J=15..16, then the answer for J=16 will be calculated using k=1.25 - and these are different.
6. I fixed this problem by changing the name of the variable to 'kk' in all of the plot setup stuff. See the attached worksheet

ctmp_corr.mw

If I now double check, by running your example of J=15..18 versus running the loop once at J=18 then the plots for J=18 seem to be the same.

There is a lot of other stuff in this worksheet which is a bit untidy/inefficient, but this is not worth doing anything about until/unless you confirm that the basic problem has been solved.

## The problem is with the subs() command...

I think the following code is OK: at least it clears up the problem with 'epsilon'.

You do have to be pretty careful when simulataneously using change of variables, and compact display (so you can't see what the variables are!) - so I inserted a couple of 'show' commands so that I could keep track

In your declaration of 'chi' and 'cont', you use both the symbol 'k', and the function 'k(s)' - is this deliberate?

restart;
with(LinearAlgebra):
with(Student[Calculus1]):
with(RootFinding):
with(PDEtools):
declare
( u(x, n, q, t),
v(x, n, q, t),
w(x, n, q, t),
p(x, n, q, t)
);
chi := 1/(1-n*k(x));
#
# OP uses 'k' in the following and 'k(x)' in the
# above - is this deliberate?
#
cont := chi*diff(u(x, n, q, t), x)+diff(v(x, n, q, t), n)+diff(w(x, n, q, t), z)-v(x, n, q, t)*k*chi;
declare
( u(s, Y, z, t),
v(s, Y, z, t),
w(s, Y, z, t),
p(s, Y, z, t)
);
contTrans := dchange
( { n = Y+h(s),
q = z,
x = s
},
cont,
[s, Y, z]
);
#
# Check variable setup in contTrans in "standard"
# notation
#
show
declare
( u0(s, Y, z, t),
v0(s, Y, z, t),
w0(s, Y, z, t),
p0(s, Y, z, t),
u1(s, Y, z, t),
v1(s, Y, z, t),
w1(s, Y, z, t),
p1(s, Y, z, t)
);
contLinearised := subs
( { p(s, Y, z, t) = p0(s, Y, z, t)+epsilon*p1(s, Y, z, t),
u(s, Y, z, t) = u0(s, Y, z, t)+epsilon*u1(s, Y, z, t),
v(s, Y, z, t) = v0(s, Y, z, t)+epsilon*v1(s, Y, z, t),
w(s, Y, z, t) = w0(s, Y, z, t)+epsilon*w1(s, Y, z, t)
},
contTrans
);
contExpand := expand(contLinearised);
show;

## Not exactly clear -...

whether you just want

a simple plot of the trajectories of the moving disks, or

to draw the two trajectories as animations?

I have added code to your worksheet which does both of the above. See below

animations.mw

## You have received "all" solutions...

In your first example _C1 is arbitrary, so

is a 'general" solution for your original ODE.

With y(x)=0, the above merely reduces to _C1=0, and since _C1 is arbitrary, _C1=0 is allowed and so the possibility y(x)=0 is "contained" within this "general" solution

In your second example y(x)=0 is an acceptable solution (provided that _C1=0), but there is also a further solution y(x)=-1/x, which works irrespective of the constant of integration

In both cases I think that Maple has provided the most general solution(s) possible - you just have to know how to interpret them

 First 105 106 107 108 109 110 111 Last Page 107 of 132
﻿