## 13776 Reputation

14 years, 64 days

## I was guessing...

OP typed it - then of course Maple "converted" it

## Then...

you have to use your original method, and live with whatever "format" the intermediate expression has

## Well, before I even look at this MathCAD...

too much, I seer the following rpoblems/potential issues

1. the numeric 'n' is undefined - maybe 2.7 (from your original Maple worksheet)
2. the indexable quantity Temp is undefined - maybe Tart (from your original Maple worksheet)
3. the calculation of P50_37[z] is very suspicious!! The exponent 0.024*(37-37), is obviously identically zero, so 10^(0.024*(37-37)), evaluates to 1 and thus P50_37[z]:=P50p37[z]. Do you do redundant calculations and introduce redundant variables for fun - or is this a typo?

If I make the assumptions in (1) and (2) above, ignore the redundancy in (3) above, and just produce some Maple code which "mimics" the MathCAD code, then I would come up with something like the attached. Note that it probably wouldn't look much like this unless I were trying to "mimic" your MathCAD code - eg why are there two loops? Why not do everything n a single loop? etc

 > restart:   pH := [7.398, 7.392]:   pO2 := [121.6, 113.4]:   Tart := [32.5, 32.9]:   n:=2.7:   for z from 1 to numelems(pH) do       P50p37[z]:=26.6*10^(-0.48*(7.4-pH[z]));       P50_37[z]:=P50p37[z]*10^(0.024*(37-37));       S[z]:= (pO2[z]/P50_37[z])^n/(1+(pO2[z]/P50_37[z])^n);   od:   for z from 1 to numelems(pH) do       P50[z]:= P50p37[z]*10^(-0.24*(37-Tart[z]));       Pcor[z]:= exp( ln( -S[z]/(S[z]-1))/n)*P50[z];   od:
 > Pcor[1];Pcor[2];
 (1)
 >

## The eval()...

statements eval(x, sol), eval(y,sol)] only want to deal with equalities, the solve () command returns a set containing the inequality a>0. This can be removed as in the attached

 > restart:   with(geometry):   _EnvHorizontalName := x:   _EnvVerticalName := y:   assume(a>0 );   interface(showassumed=0):   b := a*(1/2 + 1/6*sqrt(45 - 24*sqrt(3)))^2:   r := b*sqrt(b)/(sqrt(a + b) + sqrt(a)):   ellipse(E, x^2/a^2 + y^2/b^2 = 1):   circle(C3, [point(P3, [(1 + sqrt(3))*r, -r]), r]):   simplify(Equation(C3)):   sol:= simplify~(select( type, solve( [Equation(C3), Equation(E), x>0, y<0]), equation)):   point(PP, [eval(x, sol), eval(y,sol)]):   coordinates(PP);
 (1)
 >

## The exact version...

No use of floats. I have revised the calcultion slightly to get rid of (some of) the commands which were taking excessive time.

It still takes noticeably longer than my previus "floating point" version (about 10secs on my machine), but at least everything is now "exact", and the commands IsOnCircle(PP, C3) and IsOnCircle(PP, ic1), both return "true".

See the attached.

 > restart:   with(geometry):   _EnvHorizontalName := x:   _EnvVerticalName := y:   a := 7:   b := a*(1/2 + 1/6*sqrt(45 - 24*sqrt(3)))^2:   r := b*sqrt(b)/(sqrt(a + b) + sqrt(a)):   line(Lix,x=0):   line(Liy,y=0):   point(A, -a, -b):   point(B, -a,  b):   point(C,  a,  b):   point(F,  a, -b):   square(Sq, [A, B, C, F]):   ellipse(E, x^2/a^2 + y^2/b^2 = 1):   circle(C1, [point(P1, [r, 0]), r]):   circle(C2, [point(P2, [(1 + sqrt(3))*r,  r]), r]):   circle(C3, [point(P3, [(1 + sqrt(3))*r, -r]), r]):   reflection(C4, C1, Lix):   reflection(C5, C2, Lix):   reflection(C6, C3, Lix):   sol:= solve( [Equation(C3), Equation(E), x>0, y<0]):   point(PP, [eval(x, sol), eval(y,sol)]):   IsOnCircle(PP, C3);   line(ll1, [PP, P3]):   PerpendicularLine(ll2, PP, ll1):   point( PX, [a, rhs(isolate(eval( Equation(ll2), x=a), y))]):   point( PY, [rhs(isolate( eval( Equation(ll2), y=-b), x)), -b]):   triangle(T1, [PY, PX, F]):   incircle(ic1, T1):   IsOnCircle(PP, ic1);   point( cr2, [ coordinates(center(ic1))[1], -coordinates(center(ic1))[2]]) :   circle(ic2, [ cr2, simplify(radius(ic1))]):   point( cr3, [ -coordinates(center(ic1))[1], coordinates(center(ic1))[2]]) :   circle(ic3, [ cr3, simplify(radius(ic1))]):   point( cr4, [ -coordinates(center(ic1))[1], -coordinates(center(ic1))[2]]) :   circle(ic4, [ cr4, simplify(radius(ic1))]):   draw( [ Sq(color = blue, filled=true, transparency=0.7),           C1(color = orange, filled = true,transparency=0.7),           E(color=white,thickness=4),           C2(color = orange, filled = true,transparency=0.7),           C3(color = orange, filled = true,transparency=0.7),           C4(color = orange, filled = true,transparency=0.7),           C5(color = orange, filled = true,transparency=0.7),           C6(color = orange, filled = true,transparency=0.7),           Sq(color=blue),           ic1(color=ColorTools:-Color([0.0, 1.0, 0.0]), filled=true),           ic2(color=ColorTools:-Color([0.0, 1.0, 0.0]), filled=true),           ic3(color=ColorTools:-Color([0.0, 1.0, 0.0]), filled=true),           ic4(color=ColorTools:-Color([0.0, 1.0, 0.0]), filled=true)         ],         axes = none,         view = [-a .. a, -b .. b],         scaling = constrained       );
 >

## Am aware of this...

but at some point in the calculation of the required in-circle, the calculation started to slow down quite a lot when using exact rationals - I just assumed that I was having a bad case of "expression explosion", so rather than using solve() at the appropriate point, I switched to fsolve().

My only defence is that I assumed the OP only wanted to produce the final diagram: if exact answers are needed, just change

`sol:= fsolve( [Equation(C3), Equation(E)]):`

to

`sol:= solve( [Equation(C3), Equation(E)], x>0, y<0):`

You might also have to remove a couple of evalf() "wrappers", elsewhere.

Or you can check just how"close" the point is to the circle with

```evalf(eval( Equation(C3), [x=coordinates(PP)[1],y=coordinates(PP)[2]]));
```

which for me returns 0.=0.

## Before doing anything with this workshee...

I suggesst that you remove/fix the stuff which is just hilariously wrong - for example

1. Your worksheet contains the statement assume(0 < 1, 0 < -1, 1 < -1). My attitude to this is that everyone (inclucing Maple) *knows* that 0<1 - so why do you have to "assume" it. On the other hand the second entry, 0<-1. Do you live on a planet where this is true? That 0 is less than -1 - come on! And as for the third entry 1 < -1: again on what planet is 1 less than  -1?
2. Second problem, you have the statement ic := x1(0) = 1, x1(0) = 0. OK, which is it? Because x1(0) cannot be equal to two different values

Present something vaguely sensible!

## Hmmm...

@JAMET
I don't really understand your caclculation for the triangle T, or why the coordinates you obtain are "approximate", so in the attached I have performed the calculation a completely different way, for which the process is

1. Determine where thte circle C3 and the ellipse coincide (this is a tangent point)
2. Construct the line through the centre of C3 and the tangent point in (1) above
3. Construct the line perpendicular the line in (2) above through the point in (1) above
4. Determine the points where the line in (3) above intersects the external square Sq. This provides two points on a triangle for whihc the third point is [a, -b]. Given these three points, construction of the triangle and its incircle is trivial.

I have also shown how to use RGB values to color the four "corner" circles - using [0, 1, 0] just as an example, so these circles should appear "green", which they do in the attached

 > restart;   with(geometry):   _EnvHorizontalName := x:   _EnvVerticalName := y:   a := 7:   b := a*(1/2 + 1/6*sqrt(45 - 24*sqrt(3)))^2:   r := b*sqrt(b)/(sqrt(a + b) + sqrt(a)):   line(Lix,x=0):   line(Liy,y=0):   point(A, -a, -b):   point(B, -a,  b):   point(C,  a,  b):   point(F,  a, -b):   square(Sq, [A, B, C, F]):   ellipse(E, x^2/a^2 + y^2/b^2 = 1):   circle(C1, [point(P1, [r, 0]), r]):   circle(C2, [point(P2, [(1 + sqrt(3))*r,  r]), r]):   circle(C3, [point(P3, [(1 + sqrt(3))*r, -r]), r]):   reflection(C4, C1, Lix):   reflection(C5, C2, Lix):   reflection(C6, C3, Lix):   sol:= fsolve( [Equation(C3), Equation(E)]):   point(PP, [eval(x, sol), eval(y,sol)]):   line(ll1, [PP, P3]):   PerpendicularLine(ll2, PP, ll1):   point( PX, [a, rhs(isolate(evalf(eval( Equation(ll2), x=a)), y))]):   point( PY, [rhs(isolate( evalf(eval( Equation(ll2), y=-b)), x)), -b]):   triangle(T1, [PY, PX, F]):   incircle(ic1, T1):   reflection(ic2, ic1, Lix):   reflection(ic3, ic1, Liy):   reflection(ic4, ic2, Liy):   draw( [ Sq(color = blue, filled=true, transparency=0.7),           C1(color = orange, filled = true,transparency=0.7),           E(color=white,thickness=4),           C2(color = orange, filled = true,transparency=0.7),           C3(color = orange, filled = true,transparency=0.7),           C4(color = orange, filled = true,transparency=0.7),           C5(color = orange, filled = true,transparency=0.7),           C6(color = orange, filled = true,transparency=0.7),           Sq(color=blue),           ic1(color=ColorTools:-Color([0.0, 1.0, 0.0]), filled=true),           ic2(color=ColorTools:-Color([0.0, 1.0, 0.0]), filled=true),           ic3(color=ColorTools:-Color([0.0, 1.0, 0.0]), filled=true),           ic4(color=ColorTools:-Color([0.0, 1.0, 0.0]), filled=true)         ],         axes = none,         view = [-a .. a, -b .. b],         scaling = constrained       );
 >

## Well...

there is a missing multiplication sign in your first equation. Unfortunately whe I fix this (as in the attached) the dsolve() command never terminates - or at least not in the time I'm prepared to wait!

 >
 >

## Once again...

Given an answer, you change the question; producing more problems and errors because you are completely incapable of reading Maple help, or appreciating when you have to use a numeric approach to solving an ODE (system) and when an analytic solution is obtainable, and why the two require different plotting commands

It is also annoying thast the nswer to this problem has been provided before at

https://www.mapleprimes.com/questions/234627-I-Cannot-Generate-An--Analytic-Solution

Anyhow using exactly the saem techniques/methods whihc I have used to answer your previous questions (none of which you are interested in or capable of understanding), I can produce the attached. Just FYI, it took me less than one minute!

 >
 >
 >
 >

## Not surprised...

since the syntax of the plot command is completely wrong - have you tried reading the help page for the plot() command?

See the attached

## Hmm...

Let's see if I have this straight.

You have a (syntactically incorrect) ODE, with no boundary or initial conditions, which does not contain the parameters alpha, A0, or a.

You want a solution containing the parameters alpha, A0, and a. That would be magic not mathematics!

## Your...

@WA573 original ode is third-order. So any solution will contain three arbitrary constants.

Even if an analytic solution were possible (which it seems is not the case), it would still contain three arbitrary constants. These three arbitrary constants can only be resolved by having three initial/boundary conditions

## Weird one...

I can only include that your worksheet  rt.m.mw contains some weird non-printiing character. I exported this worksheet to a .mpl file, cleaned out anything that looked suspicious (superfluous blank lines and a NULL statement!?), then read the resulting .mpl file back into Maple, and - hey presto - now everything works. So the code in the attached *looks* exactly the same as you woirksheet rt.m.m - but it isn't!!

 > restart;   with(plots):   pu:=1/(2)*exp(-u^(2));   ode:= diff(x(u), u, u) +1/(2)*pu*x(u) = 0:   cons1:= x(0)=1, D(x)(0)=0:   cons2:= x(2)=1, D(x)(2)=0:   sol1:= dsolve([ode, cons1], numeric);   sol2:= dsolve([ode, cons2], numeric);   display( [ plot( pu,                    u=-8..8,                    color=black                  ),              odeplot( sol1,                       [u,x(u)],                       u=-8..8,                       color=blue                     ),              odeplot( sol2,                       [u,x(u)],                       u=-8..8,                       color=red                     )             ]          );
 >