Tom GIV

25 Reputation

3 Badges

2 years, 74 days

MaplePrimes Activity


These are questions asked by Tom GIV

I have functions using define_external to call a .dll  In uploaded file "dll_test.mw" I'm showing one such function.  Immediately after defining the function I call it and it works.  There are a lot more similarly defined functions and once defined in the worksheet they are working as hoped. 

My question is can I make the functions avaliable across multiple worksheets somehow?  google ai suggested using "read" but in uploaded file "read and load test.mw" you can see that it's not working for me.  using read I get an error I don't understand and using load doesn't return an error but it also doesn't result in an executable KinAddCurveData function.

Any help would be very appreciated.

KinAddCurveData := define_external('AddCurveData', 'LIB' = "C:\\Users\\tom\\Documents\\Excel docs\\kinexa dll solver\\equilibriumdll\\Equilibrium.dll")

NULL

KinAddCurveData()

 

NULL

Download dll_test.mw

read "C:/Users/tom/Documents/maple docs/KinExA tools/dll_test.mw"

Error, on line %1, syntax error, character `?` unexpected:

 

<?xml version="1.0" encoding="UTF-8"?>
 ^

 

Error, while reading `%1`

 

load("C:/Users/tom/Documents/maple docs/KinExA tools/dll_test.mw")

load("C:/Users/tom/Documents/maple docs/KinExA tools/dll_test.mw")

(1)

KinAddCurveData()

KinAddCurveData()

(2)

jhdladjkh()

jhdladjkh()

(3)
 

NULL

Download read_and_load_test.mw

I'm trying to solve a system of two differential equations numerically
 

restart

eq1 := diff(A(t), t) = c1*(A__T-A(t))-c2*A(t)*R(t)

diff(A(t), t) = c1*(A__T-A(t))-c2*A(t)*R(t)

(1)

NULL

eq2 := diff(R(t), t) = (c3+c1)*(R__T-R(t))-c2*Ab(t)*R(t)

diff(R(t), t) = (c3+c1)*(R__T-R(t))-c2*Ab(t)*R(t)

(2)
 

 

sys1 := [eq1, eq2]

[diff(A(t), t) = c1*(A__T-A(t))-c2*A(t)*R(t), diff(R(t), t) = (c3+c1)*(R__T-R(t))-c2*Ab(t)*R(t)]

(3)

A__T := 100

100

(4)

R__T := 100

100

(5)

c2 := 1000

1000

(6)

c1 := 0.2e-4

0.2e-4

(7)

c3 := 2000

2000

(8)

``

InitCond := A(0) = A__T, R(0) = R__T

A(0) = 100, R(0) = 100

(9)

nsol := dsolve(sys1, InitCond, type = numeric)

Error, (in dsolve/numeric/type_check) insufficient initial/boundary value information for procedure defined problem

 

 

It seems to me this problem should be solvable for the initial conditions given.  Am I entering them wrong somehow?

 

NULL

Download dsolve_problem.mw

I'm using Maple 2022.  I'm using fsolve to solve for values of 3 variables and I've created a function that looks like 

solution := (TtT, FtT) -> fsolve({eq1, eq2, eq3},{Y,P,PY},{Y=0..100,P=0..100,PY=0..100})

this works fine, giving answers like

solution(1, 0.5);
    {P = 0.1813175442, PY = 0.1593412279, Y = 0.4393982627}

I'd like to plot Y vs TtT at a fixed FtT of 0.5 so I defined a second function

YFtpt5 := TtT -> solution(TtT, 0.5)[3]

this also works fine, giving

YFtpt5(10);
                       Y = 0.02320766980

so I try to plot it with a range variable like this

with plots:

plot(YFtpt5,0.01..10)

but this gives the error 

plot(YFtpt5, 0.01 .. 10);
Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct

It draws axis but no plot.  I've evaluated the function at 0.01,10, and a number of points in between and everything I've tried gives a numeric answer.  Is it because the answer is "Y=0.43"  or something else.  

Page 1 of 1