## Problems with units in fsolve...

I am new to Maple and I am trying to add units to the "Flow Through an Expansion Valve" Application Demonstration.  I was trying pressure in [PSI], temperature in [degC] and flow rate in [kg/hour] everything else in SI units.  I included with(Units:-Standard) but had no luck with the fsolve function.

Any chance someone could make a version of this demonstration applicaton that includes units?

Thanks

## A geometric construction for the Summer Holiday

by: Maple

A geometric construction for the Summer Holiday

Does every plane simple closed curve contain all four vertices of some square?

This is an old classical conjecture. See:
https://en.wikipedia.org/wiki/Inscribed_square_problem

Maybe someone finds a counterexample (for non-analytic curves) using the next procedure and becomes famous!

 > SQ:=proc(X::procedure, Y::procedure, rng::range(realcons), r:=0.49) local t1:=lhs(rng), t2:=rhs(rng), a,b,c,d,s; s:=fsolve({ X(a)+X(c) = X(b)+X(d),             Y(a)+Y(c) = Y(b)+Y(d),             (X(a)-X(c))^2+(Y(a)-Y(c))^2 = (X(b)-X(d))^2+(Y(b)-Y(d))^2,             (X(a)-X(c))*(X(b)-X(d)) + (Y(a)-Y(c))*(Y(b)-Y(d)) = 0},           {a=t1..t1+r*(t2-t1),b=rng,c=rng,d=t2-r*(t2-t1)..t2});  #lprint(s); if type(s,set) then s:=rhs~(s)[];[s,s[1]] else WARNING("No solution found"); {} fi; end:

Example

 > X := t->(10-sin(7*t)*exp(-t))*cos(t); Y := t->(10+sin(6*t))*sin(t); rng := 0..2*Pi;
 (1)
 > s:=SQ(X, Y, rng): plots:-display(    plot([X,Y,rng], scaling=constrained),    plot([seq( eval([X(t),Y(t)],t=u),u=s)], color=blue, thickness=2));

## a problem in fsolve...

hello.i have a problem for solving this equation.i dont why my past post about this is deleted.!!!

thanks,,,

restart:

A1:= 27159:  n:= 0.59:  A2:= 70941:  h0:= 3e-4:
L:= 0.8:  dpx := -98100:  uc:= 0.007:  k:=2.7:

ODE:= (A3,y)->
(h0^(n+1)*L/sqrt(n)*(A1*exp(sqrt(n)*y/L)-A2*exp(-sqrt(n)*y/L))/k+dpx*y*h0^(n+1)/k+A3*(h0)^n/k)^(1/n)
;

 (1)

ODEINT:= proc(A3)
option remember;
local y;
evalf(Int(ODE(A3,y), y= 0..1, epsilon= 1e-7)) - uc
end proc:

ReINT:= proc(A3x, A3y)
Digits:= 15:
Re(ODEINT(A3x + I*A3y))
end proc:

ImINT:= subs(Re= Im, eval(ReINT)):

Digits:= 7:
a3:= fsolve([ReINT, ImINT]);

 (2)

A3:= Complex(a3[]);

 (3)

Solve as IVP:

Digits:= 15:
sol:= dsolve({diff(u(y),y) = ODE(A3,y), u(0)=0}, numeric, range=0..1,  output=listprocedure):

 >
 >

plots:-odeplot(
sol, [[y, Re(u(y))], [y, Im(u(y))]], y= 0..1,
legend= [real, imag], labels= [y, u(y)]
);

Verify that boundary condition at u(1) is satisfied:

abs(eval(u(y), sol(1)) - uc);

sol(.5);

 >

## Getting more than one result from solve...

Greetings Sirs,

I have recently aquired Maple for some mathematics, and being a new user, I basically google for everything at the moment.

While it has gone well so far, I seem to have hit a bump that I cannot figure out.

I have a function: f(x)=3.2+0.4sin(1.25x), 0<x<5

Trying to find the places where "f(x)=3.5" would normally be done with the equation "3.5=3.2+0.4sin(1.25x)", and when I solve for the equation in Maple I get a solution too.

Problem is though, I know there is supposed to be multiple solutions. Having used wolframalpha, and being capable of seeing the plot in Maple, I know there is two points within the period "x=0..5" that is the solution.

But when I try to solve the equation, I get only one solution per solve, and the second solve doesn't make much sense for me. These are what I use:

As you can see, in the first solve the entire function is being taking into consideration, yet I only get one solution... In the second solve I have tried specifying a period, but I still only get one solution.

Basically any help here is appreciated, because from what I understand, having read google, the solve command or fsolve command is supposed to give multiple results if they are there.

With appreciation,
Ciesi

(Edit: Image size changed)

## fsolve dont solve correctly ...

when i want to get awenser i have to solve it for 36 equation and 36 variabales
but maple will not give me a solution (just toss me back my variabales ) i dont know whats wrong
it will give me an awenser for lower like 20equ and 20var ?
parameters :

there is m for power an equation (equation^m) its between 2 , 2.5 , 3 , 4
and N give 2N+2var and 2N+2equ
its a hard calculation i copy it here hope u get it

h= "a number "

p := proc (x) c[-N-1]*x^2+1 end proc

dp := diff(p(x), x)

ddp := diff(p(x), x, x)

DELTA2 := piecewise(k <> j, -2*(-1)^(j-k)/(j-k)^2, k = j, -(1/3)*Pi^2)/h^2

DELTA1 := piecewise(k <> j, (-1)^(j-k)/(j-k), k = j, 0)/h

DELTA0 := piecewise(k <> j, 0, k = j, 1)

PHI := proc (x) ln(sinh(x)) end proc

dPHI := diff(PHI(x), x)

ddPHI := diff(PHI(x), x, x)

for i from -N-1 to N do x[i] := ln(exp(i*h)+(exp(2*i*h)+1)^(1/2)) end do

variabales : c[-N-1],c[-N],c[-N+1]...c[N-1],c[N] total 2N+2 var

My equations

POL := seq(simplify(eval(sum(c[k]*((eval(2*dPHI*DELTA1), x = x[j])+eval(x[j]*ddPHI*DELTA1, x = x[j])+x[j]*(eval(dPHI^2, x = x[j]))*DELTA2), k = -N .. N)+eval(ddp, x = x[j])+2*(sum(c[k]*(eval(x[j]*dPHI*DELTA1, x = x[j])+DELTA0), k = -N .. N)+eval(dp, x = x[j]))/x[j]+(c[j]*x[j]+p(x[j]))^m, x = x[j])), j = -N-1 .. N)

solving

K := fsolve({seq(POL[v] = 0, v = 1 .. 2*N+2)})

it can calculate for m=2.5 , N=15 , h=0.29669

if you can calculate it for m=3 , N=17 , h=0.41600

## Kernel connection lost...

Regarding my recent question http://www.mapleprimes.com/questions/221909-How-To-Extract-Data-From-Implicit-Function I would like to share an interesting observation. Here the code of the program:

```restart;
R0 := ln(y)+Re(Psi(1/2+(2*(p^2+(1/2)*sqrt(2*I+4*ksi_fs^2*p^2)*tanh(sqrt(2*I+4*ksi_fs^2*p^2)*x)/(tau+0.5e-2*a)))/y))+gamma+2*ln(2)
tau:= 10.000:ksi_fs:=10:p:=0.037:
R0p:= unapply(R0, [a,x]):
R0f:= proc(a,x)
local r:= fsolve(R0p(a,x), y= 0..1);
`if`(r::float, r, Float(undefined))
end proc:
M:= Matrix(
(100,100),
(i,j)-> R0f(i, 1 + (j-1)*(0.5-0)/(100-1)),
datatype= float[8]
);```

After approximately 2 hours of calculations I get a message window

But I repeat this calculations on another computer with the same Windows 7 64 bit and Maple 17 I don't get such error and I obtain desired data.

So can Maple be sensitive to the hardware?

## solving a multivariable function...

I am trying to solve system consisting of two equations and two unknowns. I tried solve but it gives back unevaluated then I tried fsolve which gives an error.

 >
 >

## Solving an equation analytically...

I am trying to evaluate the following equation analytically but it gives back unevaluated then I tried fsolve which giving me the answer but I need phi greater than  zero. How can I avoid negative values. Also Is there any ways to solve it analytically.

## issue with fsolve and Directsearch command in mapl...

Hi,

I have three simultaneous equations  with three unknown variables (E, W, T). When I solve these  simultaneous equations with fsolve command without specifying any range for variables, I don't get desirable root ( equation sol4 in maple worksheet- {E = 0.1007672475e-2, T = .7969434549, W = 0.1937272759e-2}). For this problem, I know the correct root {E = 2843.916504, T = .2782913990, W = 5344.844134} beforehand which maximize the objective function TP (equation sol8 in maple worksheet) and when I specify the narrow range of variables around the already known correct root in the fsolve command, then I get correct root ( equation sol5 in maple worksheet). If I don't know the actual answer (correct roots of the simultaneous equation) beforehand, How  could I get the correct root with fsolve command because it is very tedious work to specify different range in fsolve command repetitively to solve it by trial and error.

I also tried Direct Search method as suggested in this forum  but DirectSearch is also not able to provide the correct root (equation sol6 in maple worksheet). If I specify the narrow range around known root in direct search method ( equation sol6a in maple worksheet), then it would provide close to optimal root but if I don't know the correct root beforehand, then I couldn't specify the narrow range of variables, then how can I get correct root through direct search command.

Equation sol10 in maple worksheet  (objective function value at correct root) confirms that {E = 2843.916504, T = .2782913990, W = 5344.844134} is the correct root because it provide the value of objective function (TP) equal to 78285.85621 as opposed to negative value (TP value -12.53348074 in equation sol9)  produced by incorrect root  {E = 0.1007672475e-2, T = .7969434549, W = 0.1937272759e-2}).

Is there any method which would provide all the roots of these simultaneous equations which also include correct root. Maple worksheet is attached.

I am trying fsolve and direct search method with known root so that I could get the proper procedure to get the correct root which I can apply to another problem (set of similar simultaneous equations) for which I don't know correct root beforehand.

Ok, so i have this functions

where f(x) represent urban population and g(x) represent the rural population.

And i have to implement an algortihm in Maple to find out after what period of time x the rural population will be with 20% bigger than urban population.

I'm new in Maple and is a little bit hard for me to implement algorithms in this program.If you can help me with any idea, i will really apreciate.Thank you :).

## How to olve system of Non linear equations...

Hi,

I need to solve system of 6 non linear equations.

Down here you can see the code I wrote and at the end used to fsolve function, and it is not running. I get an error about the const 'V': Error, (in fsolve) V is in the equation, and is not solved for.

What is the right way to solve this system?

Thank you very much!

omega1 := 1.562;
omega2 := 2.449;
omega3 := 3.325;
y1 := c1*sin(omega1*t+phi1)+c2*sin(omega2*t+phi2)+c3*sin(omega3*t+phi3);

y2 := .1019*c1*sin(omega1*t+phi1)+.75*c2*sin(omega2*t+phi2)+.4608*c3*sin(omega3*t+phi3);

y3 := .407*c1*sin(omega1*t+phi1)+(0*c2)*sin(omega2*t+phi2)+1.844*c3*sin(omega3*t+phi3);

eq1 := subs(t = 0, y1) = 0;

eq2 := subs(t = 0, y2) = 0;

eq3 := subs(t = 0, y3) = 0;

eq4 := subs(t = 0, diff(y1, t)) = V;
eq5 := subs(t = 0, diff(y2, t)) = 0;
eq6 := subs(t = 0, diff(y3, t)) = 0;

eqs := [eq1, eq2, eq3, eq4, eq5, eq6];

vars := [c1, c2, c3, phi1, phi2, phi3];

fsolve({eq1, eq2, eq3, eq4, eq5, eq6}, {c1, c2, c3, phi1, phi2, phi3});

## fsolve returns unevaluated ...

i have set of equations and variable that i want to solve them using fsolve, but after about 20mintues of computations, fsolve retrun these set unevaluated, could anyone help?

 > restart:with(linalg):with(LinearAlgebra):with(orthopoly):Digits:=40: M:=3: N:=2: l:=2: for m from 0 to M-1 do L[m]:=unapply(P(m,t),t); end do: for n from 1 to N do; for m from 0 to M-1 do; BB[n,m]:=unapply(piecewise((n-1)/N<=t and t
 > ############################################# k:=Matrix(2,2,[[t*s^2,t*s^2],[s*t^2,s*t^2]]):
 >
 >
 >
 >
 >
 >
 >
 >
 >
 > ######################################
 > for i from 1 to 2 do; for j from 1 to 2 do; T[i,j]:=Matrix(N*M,N*M): for n from 1 to M*N do; for m from 1 to M*N do; T[i,j](n,m):=evalf(int(int(B[n]*k(i,j)*BS[m],t=0..1),s=0..1)): end do: end do: od: od: evalm(T[1,1]): evalm(T[1,2]): evalm(T[2,1]): evalm(T[2,2]):
 >
 >
 > ########################################## X[1]:=Matrix(M*N,1): for n from 1 to M*N do; X[1](n,1):=Y[n,1]: od: evalm(X[1]): #### yadet bashe k dar in mesal majhulat y1,y2 ####ba bordarhaye X1, X2 neshun dadi...darvaghe ####dar mesale avale maghale 2ta y dashti k bayad moadele ash ro hal mikardi...
 >
 > X[2]:=Matrix(M*N,1): for n from 1 to M*N do; X[2](n,1):=yY[n,1]: od: evalm(X[2]):
 > U[1,1]:=Matrix(M*N,1): for n from 1 to M*N do; U[1,1](n,1):=u[n,1]: od: evalm(U[1,1]):
 > U[1,2]:=Matrix(M*N,1): for n from 1 to M*N do; U[1,2](n,1):=uU[n,1]: od:
 > evalm(U[1,2]): Transpose(U[1,2]):
 > U[2,1]:=Matrix(N*M,1): for n from 1 to M*N do; U[2,1](n,1):=w[n,1]: od: evalm(U[2,1]):
 > U[2,2]:=Matrix(M*N,1): for n from 1 to M*N do; U[2,2](n,1):=wW[n,1]: od: evalm(U[2,2]):
 >
 > z[1]:=Matrix(1,M*N): z[2]:=Matrix(1,M*N): for i from 1 to 2 do; Z[i]:=Transpose(A)-add(Transpose(U[i,j]).T[i,j], j=1..2); evalm(Z[i]): z[i]:=Z[i]-convert(p[i],Matrix): od: evalm(z[1]): ############## z[1](1,2):
 > ########################################## for s from 1 to M*N do; t:=((2*s)-1)/(2*M*N); ff[1,1]:=eval(VectorMatrixMultiply(Transpose(X[1]),eval(B,t=((2*s)-1)/(2*M*N)))); F[1,s]:=multiply(ff[1,1],ff[1,1]); expand(%): H[1,s]:=VectorMatrixMultiply(Transpose(U[1,1]),eval(B,t=((2*s)-1)/(2*M*N))); hh[1,s]:=F[1,s]-H[1,s][1]; od:
 >
 > ff[1,1]:
 > F[1,1]:
 > H[1,1]:
 > hh[1,2]:
 >
 > for s from 1 to M*N do; t:=((2*s)-1)/(2*M*N); ff[2,1]:=eval(VectorMatrixMultiply(Transpose(X[1]),eval(B,t=((2*s)-1)/(2*M*N)))); G[1,s]:=multiply(ff[2,1],ff[2,1]); expand(%): J[1,s]:=VectorMatrixMultiply(Transpose(U[2,1]),eval(B,t=((2*s)-1)/(2*M*N))); JJ[1,s]:=G[1,s]-J[1,s][1]; od: JJ[1,1]: JJ[1,2]:
 > for s from 1 to M*N do; t:=((2*s)-1)/(2*M*N); ff[1,2]:=eval(VectorMatrixMultiply(Transpose(X[2]),eval(B,t=((2*s)-1)/(2*M*N)))); GG[1,s]:=multiply(ff[1,2],ff[1,2]); expand(%): g[1,s]:=VectorMatrixMultiply(Transpose(U[1,2]),eval(B,t=((2*s)-1)/(2*M*N))); gg[1,s]:=GG[1,s]-g[1,s][1]; od: gg[1,1]: gg[1,2]:
 > for s from 1 to M*N do; t:=((2*s)-1)/(2*M*N); ff[2,2]:=eval(VectorMatrixMultiply(Transpose(X[2]),eval(B,t=((2*s)-1)/(2*M*N)))); DD[1,s]:=multiply(ff[2,2],ff[2,2]); expand(%): d[1,s]:=VectorMatrixMultiply(Transpose(U[2,2]),eval(B,t=((2*s)-1)/(2*M*N))); dd[1,s]:=DD[1,s]-d[1,s][1]; od: dd[1,1]: dd[1,2]:
 > eqq[1]:=seq(hh[1,s],s=1..M*N):
 > eqq[2]:=seq(gg[1,s],s=1..M*N):
 >
 > eqq[3]:=seq(JJ[1,s],s=1..M*N):
 > eqq[4]:=seq(dd[1,s],s=1..M*N): eqq[5]:=seq(z[1](1,s),s=1..M*N): eqq[6]:=seq(z[2](1,s),s=1..M*N):
 > eq:=seq(eqq[s],s=1..M*N):
 > var[1]:=seq(X[1](s,1),s=1..M*N): var[2]:=seq(X[2](s,1),s=1..M*N): var[3]:=seq(U[1,1](s,1),s=1..M*N): var[4]:=seq(U[1,2](s,1),s=1..M*N): var[5]:=seq(U[2,1](s,1),s=1..M*N): var[6]:=seq(U[2,2](s,1),s=1..M*N):
 > EQ:=Matrix(36,1):
 > for i to 6 do EQ(6*i-5,1):=hh[1,i]; EQ(6*i-4,1):=gg[1,i]; EQ(6*i-3,1):=JJ[1,i]; EQ(6*i-2,1):=dd[1,i]; EQ(6*i-1,1):=z[1](1,i); EQ(6*i,1):=z[2](1,i); od:
 > indets(EQ);
 (1)
 >
 >
 > Var:=[seq](var[s],s=1..M*N);
 (2)
 >
 >
 >
 >
 > for i to 36 do EQQ[i]:=simplify(expand(subs([seq](indets(EQ)[i]=AA[i],i=1..36),EQ[i][1])=0)); od;
 (3)
 > fsolve({seq}(EQQ[i],i=1..36),{seq}(AA[i],i=1..36));
 (4)
 >

## fsolve in a range gives error...

I am trying to do fsolve in a range (-7..14), however, it gives no solution.

But when I solve the same equations with solve (after removing all the Imaginary solutions), I get two results, one of them is in the range (-7..14).

I even expanded the range of fsolve, say (-10..20), but still got no solution...

This is just getting weirder and weirder. Attached kindly find the Maple file, note that the first solve takes about 1 minute (on my laptop: CPU i7 + MEM 8G + SSD).

fsolve_In_Range.mw

## I'd like to have some advice to solve a non linear...

Hi everybody,

I have to solve a system  of 3 equations in 3 unknowns.
One equation is linear while the others are not because of some  sinh(cste*unknown) term.
More of this the unknowns must verify some constraints of inequality type (but always very simple ; for instance “unknown <= value”).

solve fails because of the sinh terms
fsolve fails due to the inequalities

What Maple procedure do you advise me to use to solve this system ?
(at this stage I think advices could be sufficient ; if I keep coming up against the problem I will submit you a more detailed question)

## How to find equation of the intersection between ...

With the following command I can plot two spheres and plot them.

f1 := x^2+y^2+z^2 = 1

f2 := x+y+z = 1

with(plottools);

with(plots);

S1 := implicitplot3d(f1, x = -1 .. 1, y = -1 .. 1, z = -1 .. 1, style = patchnogrid, color = blue, scaling = constrained, axes = boxed)

S2 := implicitplot3d(f2, x = -1 .. 1, y = -1 .. 1, z = -1 .. 1, style = patchnogrid, color = gold, scaling = constrained, axes = boxed)

dispaly(S1,S2)

My questions are:

1- How can I display (highlight) the circle which is the intersection between these two sphere on the same figure?

2- How can I find the equation of this circle?

Thank you.

 1 2 3 4 5 6 7 Last Page 1 of 13
﻿