C_R

1197 Reputation

18 Badges

3 years, 258 days

MaplePrimes Activity


These are questions asked by C_R

The example below is an attempt to solve a boundary value problem (BVP) without manually replacing terms in expressions and some questions where there might be room for improvement. (Only the first integration step is shown to keep it short)

My objective is to have clean Maple input with minimal manual interventions or low-level manipulations (such as using op and similar commands).

NULL

ode := diff(phi(s), s, s)+K*cos(phi(s)) = 0

diff(diff(phi(s), s), s)+K*cos(phi(s)) = 0

(1)

NULL

map(int, ode, s)

int(diff(diff(phi(s), s), s)+K*cos(phi(s)), s) = 0

(2)

Student[ODEs]:-Integrate(ode, phi(s))

Error, (in assuming) when calling 'Student:-ODEs:-Integrate'. Received: 'The given ODE, diff(diff(phi(s),s),s)+K*cos(phi(s)) = 0, is not exact'

 

...not a clue for me


Since I know the result: Multiplying by diff(phi(x), x) to make integration work.  Q1: Are there other ways to integrate a single step without a priori knowledge?

(diff(phi(s), s))*ode

(diff(phi(s), s))*(diff(diff(phi(s), s), s)+K*cos(phi(s))) = 0

(3)

NULL

int(lhs((diff(phi(s), s))*(diff(diff(phi(s), s), s)+K*cos(phi(s))) = 0), s)+c__1 = 0

(1/2)*(diff(phi(s), s))^2+K*sin(phi(s))+c__1 = 0

(4)

Boundary condition for s = L 

Eval(diff(phi(s), s), s = L) = `φ'`[0]

Eval(diff(phi(s), s), s = L) = `φ'`[0]

(5)

(4) evaluated at the boundary

expand(map(Eval, (1/2)*(diff(phi(s), s))^2+K*sin(phi(s))+c__1 = 0, s = L))

Eval((1/2)*(diff(phi(s), s))^2, {s = L})+Eval(K*sin(phi(s)), {s = L})+c__1 = Eval(0, s = L)

(6)

Q2: How to simplify expression (6) with (5) using Maple commands to get this expression for the integration constant

``

c__1 = -(1/2)*`φ'`[0]^2-K*sin(Eval(phi(s), s = L))

c__1 = -(1/2)*`φ'`[0]^2-K*sin(Eval(phi(s), s = L))

(7)

Some attempts

algsubs(Eval(diff(phi(s), s), s = L) = `φ'`[0], Eval((1/2)*(diff(phi(s), s))^2, {s = L})+Eval(K*sin(phi(s)), {s = L})+c__1 = Eval(0, s = L)); applyrule(Eval(diff(phi(s), s), s = L) = `φ'`[0], Eval((1/2)*(diff(phi(s), s))^2, {s = L})+Eval(K*sin(phi(s)), {s = L})+c__1 = Eval(0, s = L)); simplify(Eval((1/2)*(diff(phi(s), s))^2, {s = L})+Eval(K*sin(phi(s)), {s = L})+c__1 = Eval(0, s = L), {Eval(diff(phi(s), s), s = L) = `φ'`[0]}); Physics:-Substitute(Eval(diff(phi(s), s), s = L) = `φ'`[0], Eval((1/2)*(diff(phi(s), s))^2, {s = L})+Eval(K*sin(phi(s)), {s = L})+c__1 = Eval(0, s = L))

Eval((1/2)*(diff(phi(s), s))^2, {s = L})+Eval(K*sin(phi(s)), {s = L})+c__1 = Eval(0, s = L)

 

Eval((1/2)*(diff(phi(s), s))^2, {s = L})+Eval(K*sin(phi(s)), {s = L})+c__1 = Eval(0, s = L)

 

Eval((1/2)*(diff(phi(s), s))^2, {s = L})+Eval(K*sin(phi(s)), {s = L})+c__1 = Eval(0, s = L)

 

Eval((1/2)*(diff(phi(s), s))^2, {s = L})+Eval(K*sin(phi(s)), {s = L})+c__1 = Eval(0, s = L)

(8)

``

map(`^`, Eval(diff(phi(s), s), s = L) = `φ'`[0], 2)

(Eval(diff(phi(s), s), s = L))^2 = `φ'`[0]^2

(9)

Doing it manually

isolate(subs({Eval(0, s = L) = 0, Eval((1/2)*(diff(phi(s), s))^2, {s = L}) = (1/2)*`φ'`[0]^2}, Eval((1/2)*(diff(phi(s), s))^2, {s = L})+Eval(K*sin(phi(s)), {s = L})+c__1 = Eval(0, s = L)), c__1)

c__1 = -(1/2)*`φ'`[0]^2-(Eval(K*sin(phi(s)), {s = L}))

(10)

or

isolate(algsubs(value(Eval(diff(phi(s), s), s = L) = `φ'`[0]), value(Eval((1/2)*(diff(phi(s), s))^2, {s = L})+Eval(K*sin(phi(s)), {s = L})+c__1 = Eval(0, s = L))), c__1)

c__1 = -(1/2)*`φ'`[0]^2-K*sin(phi(L))

(11)

subs(phi(L) = Eval(phi(s), s = L), c__1 = -(1/2)*`φ'`[0]^2-(Eval(K*sin(phi(s)), {s = L})))

c__1 = -(1/2)*`φ'`[0]^2-(Eval(K*sin(phi(s)), {s = L}))

(12)

Q3: Are there ways to prevent commands evaluating Eval(phi(s), s = L)to phi(L)which might suggest incorrectly a new independent variable?

Q4: In (6), why is s = L sometimes in brackets {} ?

``

Download BVP_with_questions.mw

I am updating older files.

Executing with the attached code snippet from a worksheet created with Maple 16 outputs for an inert integral

instead of

Why is that and how can I fix my old worksheets to make them work with Maple 2023?

Maybe related: Execution with (or return) does not evaluate the document blocks. When all document blocks are expanded with "right click show command" the cursor does not advance to the next execution group. I can't remenber if this behaviour was allways like this or has changed.

A suggestion for Maplesoft: I have stopped using document blocks with hidden code since hiding and showing commands requires too much time (to many clicks and mouse movements). A simple double click on the marker of the document block could facilitate hiding and showing code allot.

Output_of_Int_not_in_2d.mw

alias(b = JacobiCN(sqrt(2)*sqrt(x), sqrt(2)*_Z/2)^2);
                          lessthan, b

I could not find an explanation on the help page.

I would have expected simply b as the return value.

Update:
A worksheet that generates the output


 

RootOf(JacobiCN(sqrt(2)*sqrt(x), (1/2)*sqrt(2)*_Z)^2*_Z^2+_Z^2-2)

RootOf(JacobiCN(2^(1/2)*x^(1/2), (1/2)*2^(1/2)*_Z)^2*_Z^2+_Z^2-2)

(1)

plot(RootOf(JacobiCN(2^(1/2)*x^(1/2), (1/2)*2^(1/2)*_Z)^2*_Z^2+_Z^2-2), x = 0 .. 5)

 

convert(JacobiCN(sqrt(2)*sqrt(x), (1/2)*sqrt(2)*_Z)^2, Elliptic_related)

1-JacobiSN(2^(1/2)*x^(1/2), (1/2)*2^(1/2)*_Z)^2

(2)

convert(RootOf(JacobiCN(2^(1/2)*x^(1/2), (1/2)*2^(1/2)*_Z)^2*_Z^2+_Z^2-2), Elliptic_related)

RootOf(JacobiSN(2^(1/2)*x^(1/2), (1/2)*2^(1/2)*_Z)^2*_Z^2-2*_Z^2+2)

(3)

alias(b = JacobiSN(sqrt(2)*sqrt(x), (1/2)*sqrt(2)*_Z))

lessthan, b

(4)

``

Download alias_with_lessthan_output.mw

Is there a way to determine the version of MapleSim used to create a model from the model file or within MapleSim when an older model was loaded?

[6600.0*theta(q)-17000.0*theta(q-1)+14400.0*theta(q-2)-4000.0*theta(q-3) = v(q)-.20*theta(q)+.20*theta(q-1)]

[6600.0*theta(q)-17000.0*theta(q-1)+14400.0*theta(q-2)-4000.0*theta(q-3) = v(q)-.20*theta(q)+.20*theta(q-1)]

(1)

isolate([6600.0*theta(q)-17000.0*theta(q-1)+14400.0*theta(q-2)-4000.0*theta(q-3) = v(q)-.20*theta(q)+.20*theta(q-1)], theta(q))

Error, (in isolate) invalid arguments for isolate

 

solve([6600.0*theta(q)-17000.0*theta(q-1)+14400.0*theta(q-2)-4000.0*theta(q-3) = v(q)-.20*theta(q)+.20*theta(q-1)], theta(q))[]

theta(q) = 0.1515105603e-3*v(q)+2.575709827*theta(q-1)-2.181752068*theta(q-2)+.6060422411*theta(q-3)

(2)

It works for h(x)  in help(isolate)


Download no_isolation.mw

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