MaplePrimes Questions

I want to display W__LJ as I typed it, without Maple running the calculations resulting in the output here below:

restart;

'W__LJ = 0.75 + 0.98*((1.18/Gamma)^1.9 - (1.15/Gamma)^0.98)';

W__LJ = .75+1.342152577*(1/Gamma)^1.9-1.123854165*(1/Gamma)^.98

(1)
 

NULL

Download display_formula.mw

This is important as I will place such expression in a plot like this:
textplot([2,0.9,typeset('W__LJ=0.75+0.98((1.18/Gamma)^1.9-(1.15/Gamma)^0.98)')],'font'=["helvetica","roman",35])
and I need it in the original functional form, which is easier to interpret.

I can't figure this out. Same exact patmatch works in global worksheet. But fails inside a proc.

I am using same exact code. In proc, I am doing    a::anything where `a` is now local symbol ofcourse. In worksheet, it is global ofcourse. I make sure I clear `a` in worksheet each time also.

So why it pathmatch fail in the proc? I must be doing something wrong but do not see it.,
 

26148

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

restart;

26148

a:='a':
stat:=0^n:

if patmatch(stat,0^a::anything) then
     0;
  else
     stat;
  fi;

0

foo:=proc(stat)
  local a;
  if patmatch(stat,0^a::anything) then
     0;
  else
     stat;
  fi;
end proc:

#why this does not return zero as expected?
foo(stat)

0^n

 


Here is screen shot in debugger showing patmatch failed inside the proc

 

Very strange. What do I need to change in the proc to make it work as in worksheet? 

Download patmatch_in_proc.mw

Is the following valid result from odetest? is returns 0^n when 0 was expected.

Is this a bug or valid result? Maple solution is correct, so I expected 0 only not 0^n as result.

25748

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1756 and is the same as the version installed in this computer, created 2024, June 5, 19:39 hours Pacific Time.`

ode:=diff(y(x), x)^n = 0

(diff(y(x), x))^n = 0

sol:=dsolve(ode)

y(x) = c__1

odetest(sol,ode)

0^n

odetest(sol,ode) assuming n::real

0^n

odetest(sol,ode) assuming n>0

0^n

 

 

Download strange_odetest_result_june_6_2024.mw

Update

Until this bug is fixed, I added the following to my code which checks for odetest result. it looks for 0^anything and changes it to 0. 

ode:=diff(y(x), x)^n= 0;
sol:=dsolve(ode);
stat:=odetest(sol,ode);
if patmatch(stat,0^a::anything) then 0; else stat; fi

gives    0

I found this problem when using odetest to check mysolution for this ode and was not getting 0 as expected,.

 

These two expressions are the same

e1:=-sqrt(-(exp(-2 + 2*x) - 2)*exp(-2 + 2*x))/(exp(-2 + 2*x) - 2);
e2:=1/sqrt(2*exp(-2*x)*exp(2) - 1);

Is there an automated way to simplify e1 to e2? Below are my attempts. The closest I got is 

simplify(e1) assuming real;

But that still does not give same as e2. I can do it by "hand" as shown. But I like to find automated way since this is done in code without looking at expression. So I can't use the "hand" method there.

We can assume everything in real domain.


 

15244

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

e1:=-sqrt(-(exp(-2 + 2*x) - 2)*exp(-2 + 2*x))/(exp(-2 + 2*x) - 2);
e2:=1/sqrt(2*exp(-2*x)*exp(2) - 1);
plot([e1,e2],x=-3..3)

-(-(exp(-2+2*x)-2)*exp(-2+2*x))^(1/2)/(exp(-2+2*x)-2)

1/(2*exp(-2*x)*exp(2)-1)^(1/2)

simplify(e1,size);
simplify(e1,symbolic);
simplify(e1) assuming real; #closest but still no cigar
 

-(-(exp(-2+2*x)-2)*exp(-2+2*x))^(1/2)/(exp(-2+2*x)-2)

-I*exp(-1+x)/(exp(-2+2*x)-2)^(1/2)

exp(-1+x)/(-exp(-2+2*x)+2)^(1/2)

#can do it "by hand" by dividing upstairs and downstrais by numerator
A:=exp(-1 + x);
B:=-exp(-2 + 2*x) + 2;
e3:=1/sqrt( simplify(expand(B/A^2)))

exp(-1+x)

-exp(-2+2*x)+2

1/(-1+2*exp(2-2*x))^(1/2)

#verify
plot([e3,e2],x=-3..3)

 

 


Download simplification_june_6_2024.mw

I have two surfaces crossing the z=0 plane for some ranges of x and y values.

For the first surface, x=Gamma is bounded between 0 and 10 and y=rho between -1 and +1. For the second surface, x=Gamma_1 is bounded between 0 and 10 and y=Gamma_2 between 0 and 10 as well. I want to clearly identify (parametric):

  1. For which Gamma and rho ranges of values the first surface is positive (and for which negative)
  2. For which Gamma_1 and Gamma_2 ranges of values the second surface is positive (and for which negative)

Worksheet: sign_regions.mw (highlighted in yellow my two failed attempts)

How do I get the susset that contains unknowns on the rhs of the elements?

restart

 

# I need this subset {a=1/sqrt(2+A), b=6*sqrt(4+N),  d=5*H}

 

C:={a=1/sqrt(2+A),b=6*sqrt(4+N) ,c=sqrt(7),d=5*H,,e=-12,f=-96}

{a = 1/(2+A)^(1/2), b = 6*(4+N)^(1/2), c = 7^(1/2), d = 5*H, e = -12, f = -96}

(1)

selectremove(has,indets(rhs~(C)),C)

{}, {A, H, K, N, 1/(2+A)^(1/2), (4+N)^(1/2)}

(2)

selectremove(has,lhs~(C)=indets(rhs~(C)),C)

() = (), {a, b, c, d, e} = {H, K, N, (4+N)^(1/2)}

(3)
 

 

Download 2024-06-05_Q_Select_Remove_indet_elements.mw

Hello, in a Maple script intended for Maple Learn I need to use a slider but I don't know how to get its value.

What should I do to get it?

I have a positive surface that I plot3d for bounded x- and y- value ranges. It reaches 1000 but it's mostly flat except almost at the edges of the x- and y-axes. Therefore, I inlcude view=[default,default,0..10] among the options of plot3d so that I can focus on the features of interest.

For coloring I use 'colorscheme'=["zgradient",["LightGray", "Gray", "Green"]]. However, this applies to the whole surface (up to 1000) and NOT exclusively to the viewed part as I would like to. 

Question: how to scale the zgradient so that it only applies to my "view" portion?

Note that I don't want to do this by using the 'markers' options to readjust the color splits manually, as I don't know the exact proportion and I don't want to randomly play around with different triplets until I achieve a visually satisfying result...

We see that this ode (x + y(x))*(1+diff(y(x),x)) = 0  has 2 solutions, One when (x + y(x))=0 and one when (1+diff(y(x),x))=0. Maple gives 3 solutions. They are correct but why?

Also when changing (1+diff(y(x),x)) to (a+diff(y(x),x)) now it gives only two solution.

Why does this happen? Should it not just return 2 solutions in both cases? and more strange one

(x + y(x))^2 *(1+diff(y(x), x))=0; now it gives 4 solutions. But this is no different. We also have 2 solutions. One when (x + y(x))=0 and one when (1+diff(y(x), x))=0. This time the extra two solutions are complex. 

17168

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1754 and is the same as the version installed in this computer, created 2024, June 3, 20:39 hours Pacific Time.`

ode:=(x + y(x))*(a+diff(y(x),x)) = 0;
dsolve(ode);
map(X->odetest(X,ode),[%])

(x+y(x))*(a+diff(y(x), x)) = 0

y(x) = -x, y(x) = -a*x+c__1

[0, 0]

ode:=(x + y(x))*(1+diff(y(x),x)) = 0;
dsolve(ode);
map(X->odetest(X,ode),[%])

(x+y(x))*(1+diff(y(x), x)) = 0

y(x) = -x, y(x) = -x-c__1, y(x) = -x+c__1

[0, 0, 0]

ode:= (x + y(x))^2 *(1+diff(y(x), x))=0;
dsolve(ode);
map(X->odetest(X,ode),[%])

 

(x+y(x))^2*(1+diff(y(x), x)) = 0

y(x) = -x, y(x) = -x+c__1, y(x) = -(1/2)*c__1-((1/2)*I)*3^(1/2)*c__1-x, y(x) = -(1/2)*c__1+((1/2)*I)*3^(1/2)*c__1-x

[0, 0, 0, 0]

 

 

Download why_extra_solution_from_dsolve_june_5_2024.mw

Any idea why this sometimes happens? odeadvisor says ode is quadrature but when asking it to solve it using quadrature sometimes it works and sometimes not.

Am I doing something wrong?

22020

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1754 and is the same as the version installed in this computer, created 2024, June 3, 20:39 hours Pacific Time.`

restart;

18368

Example 1 that does not work

 

ode:=diff(y(x),x)=-1;
DEtools:-odeadvisor(ode);

diff(y(x), x) = -1

[_quadrature]

sol:=dsolve(ode,y(x),['quadrature']);

"sol := "

Example 2 that works

 

ode:=diff(y(x),x)=x;
DEtools:-odeadvisor(ode);

diff(y(x), x) = x

[_quadrature]

sol:=dsolve(ode,y(x),['quadrature']);

y(x) = (1/2)*x^2+c__1

 

 

Download sometimes_dsolve_works_on_quadrature_june_5_2024.mw

Dear all

I have a data, how can I study this data using N-soft set : Normalized the data, membership function, analyse the risk, ..... compute the risk, interpret the results

Cancer_patient.xlsx

N_soft_set.mw

Thank you for your help

Maybe someone get the code working ?
 

with(plots):
with(VectorCalculus):

# Example 1: Vector Field and Visualization
V := [x, y, z]:
print("Vector Field V:", V):
fieldplot3d([V[1], V[2], V[3]], x = -2..2, y = -2..2, z = -2..2, arrows = slim, title = "Vector Field in 3D"):

# Example 2: Tangent Vector to a Curve
curve := [cos(t), sin(t), t]:
print("Curve:", curve):
tangent := diff(curve, t):
print("Tangent Vector:", tangent):
plot3d([cos(t), sin(t), t], t = 0..2*Pi, labels = [x, y, z], title = "Curve in 3D"):

# Example 3: Curvature of a Surface
u := 'u': v := 'v':
surface := [u, v, u^2 - v^2]:
print("Surface:", surface):

# Compute the first fundamental form
ru := [diff(surface[1], u), diff(surface[2], u), diff(surface[3], u)]:
rv := [diff(surface[1], v), diff(surface[2], v), diff(surface[3], v)]:
E := ru[1]^2 + ru[2]^2 + ru[3]^2:
F := ru[1]*rv[1] + ru[2]*rv[2] + ru[3]*rv[3]:
G := rv[1]^2 + rv[2]^2 + rv[3]^2:
firstFundamentalForm := Matrix([[E, F], [F, G]]):
print("First Fundamental Form:", firstFundamentalForm):

# Compute the second fundamental form
ruu := [diff(surface[1], u, u), diff(surface[2], u, u), diff(surface[3], u, u)]:
ruv := [diff(surface[1], u, v), diff(surface[2], u, v), diff(surface[3], u, v)]:
rvv := [diff(surface[1], v, v), diff(surface[2], v, v), diff(surface[3], v, v)]:
normal := CrossProduct(ru, rv):
normal := eval(normal / sqrt(normal[1]^2 + normal[2]^2 + normal[3]^2)):
L := ruu[1]*normal[1] + ruu[2]*normal[2] + ruu[3]*normal[3]:
M := ruv[1]*normal[1] + ruv[2]*normal[2] + ruv[3]*normal[3]:
N := rvv[1]*normal[1] + rvv[2]*normal[2] + rvv[3]*normal[3]:
secondFundamentalForm := Matrix([[L, M], [M, N]]):
print("Second Fundamental Form:", secondFundamentalForm):

# Compute the Christoffel symbols
# Ensure DifferentialGeometry package is loaded
with(DifferentialGeometry):
DGsetup([u, v], N):
Gamma := Christoffel(firstFundamentalForm):
print("Christoffel Symbols:", Gamma):

# Visualize the surface
plot3d([u, v, u^2 - v^2], u = -2..2, v = -2..2, labels = [u, v, z], title = "Saddle Surface in 3D"):

 

I was about to convert -1 to exp(I*Pi).

First try by intuition

convert(-1, exp);
                               -1

False intuition. Next try by right click on -1 and consulting the context pannel: -> nothing that rings a bell

Entering a complex number 0.5000000001 + 0.8660254037*I to see if that changes something

-> something but no exponential form
                          

Next: AI assitant

->   OK, I know this. -> refine query

Polar, of course!

convert(-1, polar);
                          polar(1, Pi)

Not what I want. Maybe

convert(convert(-1, polar), exp);
                               -1

Next -> Ask for help in MaplePrimes whether there is a command

In relation to my comment below:
https://www.mapleprimes.com/questions/238277-Robustness-Of-Plotevalsomething#comment301920 (whose my worksheet rho-analysis_mmcdara_Gammapositive_MaPal.mw builds on the Sturm's analysis of @mmcdara)

I would like to better understand how to isolate/pin down the 4 real roots whose existence was confirmed by Sturm's analysis. To do so, @acer suggested to look into RootFinding:-Parametric: rho-analysis_acc(1).mw
Questions:

  1. Why the plot doesn't change if I also include -1<rho and rho<1 among the equations to solve? I understood that regions 1, 4 and 5 have 0 solutions anyway but if I add the constraints on rho I should expect 2 regions instead of 5, right?

  2. I don't understand SampleSolutions(m,2)=0.56 and SampleSolutions(m,3)=0.51 (even after reading help page). How are these numeric values found?

  3. Looking at the big picture, how to reconcile this CellPlot with A) my plot3d of Eq in https://www.mapleprimes.com/questions/238277-Robustness-Of-Plotevalsomething#comment301920 and B) @mmcdara Sturm's analysis. I am having a hard time putting all together.

    Thank you. 

    EDIT: I formulated this question by branching out from my comment 
    https://www.mapleprimes.com/questions/238277-Robustness-Of-Plotevalsomething#comment301920 in the corresponding thread. If inappropriate, please help me migrate this question as appropriate. 

I tried to solve a hogher order ODE system to reduce first order ODE sytem. In this case I have assume a initial conditions as a variable. (sse the attachment, Conver_to_first_order.mw).

I got an error in specification of initial value...

How can I solve this problem in RKF45 method with shooting technique.

Here, I have assume f=x[1], f'=x[2]. f''=x[3], f'''=x[3]' and theta=x[4], theta'=x[5], theta''=x[5]'

First 10 11 12 13 14 15 16 Last Page 12 of 2338