## MapleSim & Modelica_LinearSystems2: Do both work t...

On the corresponding Modelica page I find

Since MapleSim 2024 now has been upgraded to Modelica 4.0 (which I appreciate very much by the way - Thank you), I was wondering if I could give this libraray a try?

I am looking for simple ways to set up digital controllers in the context of developement of code for micro-controllers. From the github page:

Furthermore, in sublibrary Controller about 20 input/output blocks of linear systems are provided that are based on the different representation forms, e.g., PID, StateSpace, Filter blocks. A unique feature of these blocks is that it is very convenient to quickly switch between a continuous and a discrete block representation. Also, templates are provide to quickly built-up standard controller structures.

## Numerical test of the solution of the differential...

hi,

I don't know how to test the answers I got in Mathematica, can you help me?
I can't send the file here, I really need help.

## solve elliptic PDEs...

As Maple is not equipped to handle numerical solutions of elliptic PDEs, can anyone help top solve PDEs by finite differences or any other numerical solver?

pde.mw

## Where is the code that simplifies this ...

Can't figure out what code makes this simplification.
If this simplification works, it will be a part of a larger simplication procedure ( if it not conflicts hopefully)
vereenvouding_hoe_-vraag_MPF.mw

## PDEtools:-Solve vs. solve. RootOf form difference...

I was trying to find out why my solution was not validating for this ode. It turned out because I was using solve instead of PDEtools:-Solve. It took me sometime to find this.

This made huge difference on odetest to verify the solution.

This is very simple ode. We just need to integrate once. But first we have to solve for y'(x).

And here comes the difference. When I used solve to solve for y'(x), odetest did not verify the solution.

When using PDEtools:-Solve, it did.

The difference is how each returned the solution for y'(x). Both have RootOf but written differently and this made the difference.

1) Why solutions are written differently?

2) Is this to be expected? I have thought Solve uses same engine as solve below the cover.

3) is it possible to make solve give the same form as Solve or change to that form?

I am now changing more of my code to use PDEtools:-Solve because of this.

 > interface(version);

 > Physics:-Version();

Using solve

 > restart;

 > ode:=x-ln(diff(y(x),x))-sin(diff(y(x),x))=0; RHS:=solve(ode,diff(y(x),x));

 > mysol:= y(x) = Int(RHS,x)+c__1;

 > odetest(mysol,ode);

using PDEtools:-Solve (now it verifies) with no extra effort

 > restart;

 > ode:=x-ln(diff(y(x),x))-sin(diff(y(x),x))=0; RHS:=PDEtools:-Solve(ode,diff(y(x),x)): RHS:=rhs(%);

 > mysol:= y(x) = Int(RHS,x)+c__1;

 > odetest(mysol,ode);

Update

Here is a counter example. Where now it is the other way around.

Using solve makes odetest happy, but when using PDEtools:-Solve odetest does not verify the solution.  Same exact ODE.

 > interface(version);

 > Physics:-Version()

Example, using solve works

 > ode:=exp(diff(y(x), x) - y(x)) - diff(y(x), x)^2 + 1 = 0; RHS:=solve(ode,diff(y(x),x)); RHS:=eval(RHS,y(x)=y); mysol:=Intat(eval(1/RHS,y=_a),_a=y(x))=x+c__1; odetest(mysol,ode);

Example, using PDEtools:-Solve fails

 > ode:=exp(diff(y(x), x) - y(x)) - diff(y(x), x)^2 + 1 = 0; RHS:=rhs(PDEtools:-Solve(ode,diff(y(x),x))); RHS:=eval(RHS,y(x)=y); mysol:=Intat(eval(1/RHS,y=_a),_a=y(x))=x+c__1; odetest(mysol,ode);

 >

So now I have no idea which to use. Sometimes solve works and sometimes Solve works. I  guess I have to now solve the ode both ways each time and see which works.

## My rant of the day...

This is an extremely common situation; either some moderator displaced or deleted the question, or the OP deleted himself (herself).
Whatever the reason, it's always extremely upsetting to be confronted with this situation, which shows how rude, to put it mildly, some people can be.

Initial question (this day, about 2 hours ago)

Comment

## N-Soft set : Membership function, ...

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

## Visualize a surface : saddle surface...

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"):```

## should int() result match exactly what is given as...

Simple question. I hope it has simple answer. I have always thought that what int() returns should match exactly what "default" result shows when using int() with the option _RETURNVERBOSE

I mean exact match. But this below shows that int() result underwent some simplification as it is not the same as default.

```restart;

integrand:=sin(x)/(sin(x) + 1);
maple_result_1 :=int(integrand,x);
maple_result_2 := int(integrand,x,'method'=':-_RETURNVERBOSE')[1]

```

Ofcourse maple_result_2 can be made the same as maple_result_1

```simplify(rhs(maple_result_2)) assuming 0<x and x<Pi;
```

But this is beside the point. Why is "default" is not excatly the same as int() result?  It seems that int() does something more after obtaining the :"default" result as shown.

Should default not match exactly result from int() ?

Maple 2024.

## Numeric Formatting Causes Maple to Hang...

I put together the attached worksheet to help me determine the cheapest way to buy "refreshments" for a party by comparing price and volume of different bottle size options.  The spreadsheet works fine as is.  However, when I right click on the output of line (14) and format pct_difference as percent with 2 decimal places and execute the worksheet, Maple hangs on that line and progresses no further.  This doesn't happen in Maple 2018 but the problem does show up in Maple 2024.  Suggestions please?

cost_comparison_-_liquid_(v01MP).mw

## Section plane solids...

This is still a  starting procedure and let's see what can be added?

 > restart; # Define the procedure to draw a cylinder along the x-axis and a specifically positioned plane CylinderAndPlane := proc(r, h, alpha_deg, beta_deg, P, axis_length)     local alpha, beta, cylinder, plane, pointPlot, display, nx, ny, nz, px, py, pz, annotations, plane_type, titleStr, grafiek;  # Added: titleStr     uses plots, LinearAlgebra;       # Convert angles from degrees to radians     alpha := alpha_deg * Pi / 180;     beta := beta_deg * Pi / 180;     # Determine the normal vector based on angles     nx := cos(alpha) * sin(beta);     ny := sin(alpha) * sin(beta);     nz := cos(beta);     # Point P is directly used as given coordinates     px, py, pz := op(P);     # Cylinder along the x-axis     cylinder := plots:-implicitplot3d(y^2 + z^2 = r^2, x = 0 .. h, y = -r .. r, z = -r .. r, style = surface, color = "LightBlue", transparency = 0.5);     # Determine the type of plane based on angles alpha and beta     if beta_deg = 90 then         plane_type := "yz";         plane := plots:-implicitplot3d(x = px, x = px - 10 .. px + 10, y = -axis_length .. axis_length, z = -axis_length .. axis_length, style = surface, color = "Yellow", transparency = 0.5);     elif alpha_deg = 90 and beta_deg = 0 then         plane_type := "xz";         plane := plots:-implicitplot3d(y = py, x = -axis_length .. axis_length, y = py - 10 .. py + 10, z = -axis_length .. axis_length, style = surface, color = "Green", transparency = 0.5);     elif beta_deg = 0 then         plane_type := "xy";         plane := plots:-implicitplot3d(z = pz, x = -axis_length .. axis_length, y = -axis_length .. axis_length, z = pz - 10 .. pz + 10, style = surface, color = "Blue", transparency = 0.5);     else         plane_type := "arbitrary";         plane := plots:-implicitplot3d(nx * (x - px) + ny * (y - py) + nz * (z - pz) = 0, x = -axis_length .. axis_length, y = -axis_length .. axis_length, z = -axis_length .. axis_length, style = surface, color =            "Red", transparency = 0.7);     end if;     # Mark point P     pointPlot := plots:-pointplot3d([px, py, pz], symbol = solidcircle, symbolsize = 10, color = "Red");     # Create dynamic title - New     titleStr := cat("Plane: ", plane_type, "\nAlpha: ", sprintf("%.2f", alpha_deg), " deg\nBeta: ", sprintf("%.2f", beta_deg), " deg\nPoint: [", sprintf("%.2f", P[1]), ", ", sprintf("%.2f", P[2]), ", ", sprintf("%.2f", P[3]), "]");     # Display everything together - Modified: titleStr added in the display function     grafiek := plots:-display(cylinder, plane, pointPlot, axes = normal, scaling = constrained, labels = ["x", "y", "z"], title = titleStr);     return grafiek; end proc: # Example call to the procedure with coordinates of P and setting the axis length # Alpha and Beta are now angles in degrees, P is a list of coordinates, axis_length is the length of the coordinate axes CylinderAndPlane(15, 50, 0, 90, [15, 5, 5], 30);  # For yz-plane #CylinderAndPlane(5, 15, 90, 0, [5, 5, 5], 10);  # For xz-plane #CylinderAndPlane(5, 15, 0, 0, [5, 5, 5], 10);   # For xy-plane #CylinderAndPlane(5, 55, 45, 45, [5, 5, 5], 10); # For arbitrary plane

## how to get the coefficient of x in this expression...

sol := y = -3283/4253 - (3283*x)/4253, How can I determine the value of the coefficient of x?
How can I take the value of the coefficient of x? Thank you.

## Why does this command only works in Maple and not ...

I am stuck this command works seemlessly in Maple:

ThermophysicalData:-CoolProp:-Property(D, T = 20*Unit('degC'), P = 760*Unit('mmHg'), water)

but it does not work in Maple Flow. Does anyone knows why? Thank you so much for your help in the matter.

## How come does "residualQQplot" give me a strange ...

Hello :)

I have a math problem, where I first need to use Linear regression to find the equation based on a set of data. I did that, no problem.

However, in the next part of the problem I need to check if the residuals are under "normal distribution". Usually, I check if a dataset is normally distributed via "QQ-plot", and there will be no problems. But this time, because I need to check the residuals, I need to use the "residualQQplot(data,LinReg)" command to make it happen. But when I read the mean-value, mu, it says "-0," and nothing else? I know it should be "-3,2752*10^-15.

The standard deviation is correct.

How do I fix this, so the residualQQplot shows me the right result?

I have attached the worksheet here. worksheet_-_linear_reg_and_residuals_for_normal_distribution.mw

Thank you!

## Maple gives solutions may have been lost unless tw...

I can't understand this behavior. Any idea why it happens?

Solve is able to solve equation   f(y)=x+A for y, but can't solve   f(y)=x for y.

This is unexpected for me. I do not see why it can solve it when RHS is x+A but not when RHS is just x.

 > interface(version);

 > Physics:-Version();

 > restart;

 > sol:=int(1/sqrt(sin(y)),y); solve(sol=x,y)

Warning, solutions may have been lost

 > sol:=int(1/sqrt(sin(y)),y); solve(sol=x+b,y): {%}; #to eliminate duplicates

 >

I can trick it to solve  f(y)=x for y  by asking it to solve f(y)=x+A for y and then set A=0 in the solution. But one should not have to do this. Is this a bug or Am I missing something?