icegood

285 Reputation

14 Badges

12 years, 266 days

MaplePrimes Activity


These are answers submitted by icegood

unfortunately fdiff is not case for me because i need also zero limits of higher orders.

For lhopital: actually should work, because series exists and has finite limit, but it's not case for this task anyway because of slowness of limit itself.

multiseries... could be useful, will try!

all of that stuff rather crazy, isn't it?

userinfo more suitable. But... why fflush doesn't work...

Found! 'Add' suitable for that rather than 'sum'.

Tried with simple proc to ensure that problem in concrete case not inly in limit itself but also in expansion. So, simple substitution to :

p:=proc(expr,n) local s, exprout;
exprout:=expr;
for s in indets(expr) do
  if y in indets(s, symbol) then
    exprout:=subs(s=convert(series(s,y,n),polynom), eval(exprout,1));
  end if;
end do;
return exprout;
end proc:

with expr=Hexpr and n=5 without success. Could it be somehow better done?

c:=eval(c+1);

with this part it's clear. What about logic of that? There i mean next: of course for pair of assignments
b:=c;
c:=b+1;
should be reccusion check error raised because all of them are symbols. But for triple
c:=1;
b:=c;
c:=b+1;

reccursion check result become correct again.
Same for single operator:
c:=c+1; should reccursional error raised
and
c:=1;
c:=c+1;
should be correct again.
But why reccursion check raises in last case? It's rather ugly :(

And what about branch?

completly good! One problem less!

Thanks for all of you.

Code works before in other version when 'pure' evalhf called. Evalhf doesn't deal with garbage collector (help), but after i begin to use eval - maybe there collector works. That's why i think it's case. If you would remove eval calls from functions - everything would work again independently where rt created.

MainFDerivativeAS := diff(MainFS, a); MainFDerivativeAI := unapply(MainFDerivativeAS, y, a, b);
MainFDerivativeA := proc (u, v, w) options operator, arrow; eval(MainFDerivativeAI(u, v, w)) end proc;

 

Only such syntax both fast (due only S-suffix expressions in diff presented) in symbolic calc and evaluable via evalhf (MainFDerivativeA is evaluable). Intermadiate one more + eval.

When you say about problems you must all time mention about what you get versus what you want.

From my point of view there are many problems beginning with sytax. Where do-end do pair for "for" statement? Have you read help for "for" command (?for)

Dear developers! Check EvalMapleStatement for memory leak! Memory consuption about 70 times less! (17mb vs 1,2Gb)

About fastest code, i don't know but also suspect that its because of sprintf from my side and convertor back to func on side of maple dll/lib. For many calls program seems to be ~7 times faster...

 

Final code:

static MKernelVector ExternalKernel;
typedef struct _TFuncCache
{
  const char *Name;
  ALGEB DirectFastPointer;
} TFuncCache;
//names of fuctions called from main maple code
static TFuncCache FuncNames[]= {{"MainF"}, {"MainFDerivativeA"}, {"MainFDerivativeY"}, {"MainFDerivative2AA"},
  {"MainFDerivative2AY"}, {"MainFDerivative2YY"}, {"MainFDerivative3AAA"}, {"MainFDerivative3AAY"}, {"MainFDerivative3AYY"},
  {"MainFDerivative3YYY"}, {"MainFDerivative4AAAA"}, {"MainFDerivative4AAAY"}, {"MainFDerivative4AAYY"},
  {"MainFDerivative4AYYY"}, {"MainFDerivative4YYYY"}};

static void InitFuncPointers()
{
  int i;
  ALGEB f;
  char expr[1024]; //general expression
  //
  for(i=0;i<sizeof(FuncNames)/sizeof(FuncNames[0]);i++)
  {
    f=ToMapleName(ExternalKernel, FuncNames[i].Name, TRUE);
    if( !f || !IsMapleProcedure(ExternalKernel,f) )
    {
      sprintf(expr, "unable to compute function by name %s", FuncNames[i].Name);
      MapleRaiseError(ExternalKernel, expr);
      return;
    }
    FuncNames[i].DirectFastPointer=f;
  }
}
 
static ice_real_TReal MyExternalFuctionEval(ice_real_TReal y, ice_real_TReal a, ice_real_TReal b, const int DifNo)
{
  FLOAT64 args[4];
  ALGEB f;
  //
  f=FuncNames[DifNo].DirectFastPointer;
  args[1]=y;
  args[2]=a;
  args[3]=b;
  return (ice_real_TReal) EvalhfMapleProc(ExternalKernel, f, 3, args);
}

Everything isOK now. The problem was to find proper Process ID to which debugger should attached.

Understand answer by myself. Obviously maplec.lib is just look like to be a wrapper over maplec.dll which, of course, called dynamically, so program should find maplec.dll on running stage, so path \Maple\bin.win\ shoul also be in environment

Thank you for your reaction, but i need smth different: there is no differential equation at all. I need rather find surface in (a,b,c) space for which exist such y that:

H'(y; a,b,c)=H''(y; a.b, c)=0. Of course H is such complex enought, that there is no implicit algebraic solution. So question rather can reformulated: how within numerical solutions possible to build required surface with arbitrary error over wide enought range of all of 3 parameters.

1 2 Page 2 of 2