MaplePrimes Questions

Why do I get this wrong result when I try to solve formally this ode (note that acer has already obtained its implicit form here implicit)

restart:
interface(version)
Standard Worksheet Interface, Maple 2015.2, Mac OS X, December 21 2015 Build ID 1097895

edo := diff(y(x), x, x) = 1/y(x) - x*diff(y(x), x)/y(x)^2;
ic  := y(0)=1, D(y)(0)=0:

dsolve({edo, ic}, y(x));
eval(edo, %)
                                        / d      \
                                      x |--- y(x)|
               d  / d      \    1       \ dx     /
              --- |--- y(x)| = ---- - ------------
               dx \ dx     /   y(x)          2    
                                         y(x)     
                    
                            y(x) = 1

                             0 = 1


Thanks in advance

sometimes Maple's solution for an ode is not valid for all x. When I run odetest on the solution, it is not zero.

For the case when the output of odetest contains one csgn(), I am trying to determine if odetest result will become zero, when csgn is +1  or -1. If so, then next look into the argument of csgn and solve for x under this condition and hence find the range of x when the solution is valid.

I wrote the following to do this and check the idea.

I'd like to ask if the Maple experts here can suggest improvement or if there a better way to do this.

The code below works if there is only instance of csgn() in the output of odetest. Which covers almost all the cases I saw so far.

The code first checks if csgn is present in the output of odetest. If so, it then uses indents to pick up the function csgn out. Then uses op to pick its argument. Then uses solve with inquality to find when the argument is either positive or negative. This results in the range of x needed to make odetest zero.

This is just a quick prototype to test the idea. This not the final code I will be using as that will include more checks and be more robust. 

restart;
ode :=diff(y(x),x)=2*(x*sqrt(y(x))-1)*y(x):
ic  :=y(0)=1:
sol :=dsolve([ode,ic]):
res :=odetest(sol,ode);

So we see odetest did not give zero.  The issue is that I can't just do 

solve(res=0,x)

It does not work.  So that is why I had to look inside as follows:

The goal is to check if when csgn is either +1 or -1, if it will then become zero.

And if so, then also find the range of x which will caused this.  In the above, we see that when 1/(x+1) is +1, then odetest result  will become zero. This means x has to be larger than -1.

Note that this is all done in code, without being able to look at the screen and then decide what to do

if res<>0 then
    if has(res,csgn) then
        if simplify( subsindets(res,csgn(anything),f->1)) = 0 then      
            print("the odetest becomes zero when csgn is POSITIVE");
            Z:=indets(res,specfunc(csgn));
            the_args:=map(x->op(x),Z);
            print("Now solve ",the_args," for x, when the expression is POSTIVE");
            for tmp in the_args do
                result:=solve(tmp>0,x);
                print("the solution is valid for x>", op([1,1],result));
            od;
        else
            if simplify( subsindets(res,csgn(anything),f->-1)) = 0 then      
                print("the odetest becomes zero when csgn is POSITIVE");
                indets(res,specfunc(csgn));
                the_args:=map(x->op(x),Z);
                print("Now solve ",the_args," for x, when the expression is negative");
                for tmp in the_args do
                    result:=solve(tmp<0,x);
                    print("the solution is valid for x<", op([1,1],result));
                od;
            else
                print("give up. Tried when csgn is positive or negative");
            fi;
        fi;
    fi;
fi;

If there is more than one csgn function in the odetest result, it will become much more complicated, since one have to check all combinations to find under which combination odetest will become zero. So for now, I am just doing this only for one case of csgn present.

 

I have a function defined by this integral: f(x):=int((sin(t)^2)^(exp(t)),t=x..infinity). The question is how to plot this function from x=-5 to x=+5 in Maple 2020? I do as follow, but it does not work for Maple 2020 (15 days trial version).

f := int((sin(t)^2)^exp(t), t = x .. infinity)
plot(f, x = -5 .. 5)

Maple version: Maple 2020.2, Maple Build ID 1502365.

Thank you very much. 

Not that I can't sleep quietly without it, but why is the possibility of receiving a vote or being selected as the best answer (ok, this rarely happens) no longer proposed in my replies?
For instance, in a recent reply (not the one I'm the prouder of) the header appears like this, witho ot thum nor star below "1 hour ago")


TIA

Please see the question posed in the opening text of the uploaded worksheet.

Oloid.mw

I have a function:

T(t) := (t+459.47) * 5/9  ,  convert degrees F to Kelvins.

I want to produce a table of values over a range of 100F to 250F with two colums,

Degrees F and Kelvins.

I have no problem doing this in Mathcad Prime, but I'm lost as to how

to accomplish this in Maple.

I am evaluating the Maple trial as a potential replacement for Mathcad Prime,

but at this point it may not work for me.

Hi,

I am trying to verify the general solution to the nonlinear ode

diff(y(x), x, x) = 1/y(x) - x*diff(y(x), x)/y(x)^2  (1)

Maple says this expression is invalid when I try to enter it using the button.  I can copy and paste this expression into maple, however, and it works fine.

 

I take the second derivative of the general solution, then use the solve(solution, diff(y(x),x,x) command to try to put the second derivative in the form of (1).  The result from this command does not match the original ode, but the odetest( ) funtion returns a value of zero. 

 

How do I "manually" verify this solution with maple?  I am investigating a certain type of equation, and my solution technique so far involves rewriting the equation into a different form (nonlinear PDE) and then solving the PDE.  I am building up maple skills to eventually do that.

 

For your reference, this equation is from a maple help page:

 

https://www.maplesoft.com/support/help/maple/view.aspx?path=odeadvisor/exact_nonlinear

 

I would really appreciate some help with this,

Steve :)

Hello everyone !

 

I would like to know if there's a way to get simplified expressions for multivariables expressions...

 

for a simple example :

 

expand((a+b)^2) returns a²+b²+2ab

how could I get (a+b)^2 from a²+b²+2ab ?

 

for a more complicated example :

factor([2*x^3 - 6*x*y*z + 2*y^3 + 2*z^3])

returns :


        [2 (x + y + z) (x²  - x y - x z + y²  - y z + z²)]

but since :

2*(x²  - x y - x z + y²  - y z + z²) = (x - y)^2 + (y - z)^2 + (z - x)^2

 

is there a way to get that kind of simplification ?

 

thank you for your time

 

Hello everybody,

In my code, i would like to create a square matrix M of dimension 'a' (which is a ColumnDimension of an imput matrix A):
Otherwise, i have an expression ('EXPR') on alpha[i](x) and beta[i](x), i=1..b, (where b is a ColumnDimension of an imput matrix B).
The matrix M that i want to get must be M:=(EXPR(alpha[i],beta[j])),i,j=1..a, evaluated for particular alpha[i](x) and beta[j](x) wich are stored in A and B respectively.

Below, is the code that i write: 

Test := proc(A, B,EXPR)
local a, b, M, i, j, k;
a := LinearAlgebra['ColumnDimension'](A);
b := LinearAlgebra['ColumnDimension'](B);
M := Matrix(a);
for i to a do for j to a do
if evalb(i = j) then
M[i, j] := M[i, j] + eval(EXPR, {seq(alpha[k] = (t -> eval(A[k, i], x = t)), k = 1 .. b), seq(beta[k] = (t -> eval(B[j, k], x = t)), k = 1 .. b)}); else
if evalb(i < j) then
M[i, j] := M[i, j] + eval(EXPR, {seq(alpha[k] = (t -> eval(A[k, j], x = t)), k = 1 .. b), seq(beta[k] = (t -> eval(B[i,K], x = t)), k = 1 .. b)}); else
M[i, j] := M[i, j] + eval(EXPR, {seq(alpha[k] = (t -> eval(A[k, j], x = t)), k = 1 .. b), seq(beta[k] = (t -> eval(B[i, k], x = t)), k = 1 .. b)}); end if;
end if;
end do;
end do;
return M;
end proc:

I tested the program for A, B and EXPR given by: 
A := Matrix(2, 3, [[4, x, 1/4*x^2], [2, 3, x]]);
B := Matrix(3, 2, [[3, 5], [x, 2], [1/2*x^2, -x]]);
EXPR := alpha[1](1/2)*beta[1](1/2) + int(alpha[1](x + 1/2)*beta[2](1/2*x), x = -1/2 .. 1/2) + alpha[2](1/2)*beta[2](1/2);

Maple returns the following:  Error, (in anonymous procedure called from Test) bad index into Matrix.
I understood that the problem comes from the k that I wrote in bold in the code.
I would like to evaluate the EXPR for alpha[k]:=A[k, i] and beta[k]:=B[j,k] , but I don't really know how to interpret this for maple.

Could you help me please ?
Do you have an idea ?

Best regards,

I am an electrical engineer and have been using Matlab for years.  I am switching over to Maple and am converting my extensive library of Matlab scripts to Maple.  

Among other things, I plan on using Maple, as I have Matlab, to determine component values based on design criteria (e.g. input voltage range, output voltage range, etc.) and to analyze the resulting circuit uncertainties.

I have generally released the uncertainty results to my clients and like to use the appropriate mathematical symbols to convey the information.  

I would eventually like to generate a report for my client that shows the calculated component values and the resulting uncertainties (e.g. "R1 = 2.56kΩ ± 0.01%", "Total uncalibrated uncertainty (maximum) = ±(0.23452% of reading + 0.198°C)")

I see that outside of a code edit region, I can freely use the symbols from the "common symbols" palette to generate text as shown above.

Should I avoid trying to automate this (i.e. using printf() statements)?

 

I found small problem in Latex(). When putting solution of ODE inside a Vector, Latex() fails to convert and returns empty vector.

restart;
sol:=[dsolve(diff(diff(y(x),x),x)*y(x) = 1,y(x))];
sol:=convert(sol,Vector);

And now

Latex(sol)


               \left[\begin{array}{c} \\ \end{array}\right]

Empty array. But if not in a Vector, it works

restart;
sol:=[dsolve(diff(diff(y(x),x),x)*y(x) = 1,y(x))];
Latex(sol)

# no problem here ====>

\left[
{\textcolor{gray}{\int}}_{}^{y \! \left(x \right)}\frac{1}{\sqrt{2 \ln \! \left(\mathit{\_a} \right)-2 \mathit{\_C1}}}\textcolor{gray}{d}\mathit{\_a} -x -\mathit{\_C2}
 = 0, 
{\textcolor{gray}{\int}}_{}^{y \! \left(x \right)}-\frac{1}{\sqrt{2 \ln \! \left(\mathit{\_a} \right)-2 \mathit{\_C1}}}\textcolor{gray}{d}\mathit{\_a} -x -\mathit{\_C2}
 = 0\right]

 

This seems to happen on some solutions (may be those with Int because in this other example, it works with Vector):

restart;
sol:=[dsolve(diff(diff(y(x),x),x)*y(x)^2 = 0)];
sol:=convert(sol,Vector);

And now

Latex(sol)

#now it works ===>

\left[\begin{array}{c}y \! \left(x \right)=0 \\y \! \left(x \right)=\mathit{\_C1} x +\mathit{\_C2}  \end{array}\right]

I am using Maple 2020.2 with Physics 897

Edit 1/2/2021

I found another strange problem with Latex conversion related to Vector. If the first entry is y(x)=0 in the vector, then it keeps this, but throws away the rest of the entries in the Vector.

This might be related to the same bug. Not sure. Here is an example

restart;
ode:=(2*cot(x)*diff(y(x),x)*y(x)+diff(y(x),x)^2-y(x)^2 = 0,singsol=all);
sol:=convert([dsolve(ode)],Vector)

Now watch what happens when converting sol to Latex

Latex(sol)

    \left[\begin{array}{c}y \! \left(x \right)=0 \\ \\ \end{array}\right]

Only reason I use Vector() is to display in Latex many solutions on top of each others, so easier to see instead of as a list() where they are all on one line, which might not fit the page.

I need to find an alternative to using Vector to do this. 

Can I clear variables by a command instead of assigning them their quoted name?  For example, I know that I can clear M and B by:

M,B:='M','B'.

Is there a command like forget(M,B)?

I don't want all of ther variables cleared so I don't want to use restart.

 

Hi,

I would like to use greek letters and other special symbols in printf() statements in a code edit region.

Is there a way that I can do that? 

 

I have to create a function which records the angle and angular frequency of an aspherical moon orbiting a planet at each periapsis to create a Poincare section plot of theta agaisnt omega. I cannot get eval to work out the solutions to the ODEs to plot the points. Additionally I then have to create another function to plot the FFT of the angular frequency from an array. 

This is what I have tried so far:



Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/Project.mw .
 

Download Project.mw

For some reason every := on my work sheet has turned to "d" how to if fix this.

 

First 340 341 342 343 344 345 346 Last Page 342 of 2308