Message Boards Message Boards

0
|
9649 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

How to obtain a derivative of a list of data?

Posted 10 years ago

Hello,

my problem is that I want to define in a model a boundary condition (BC) with zero gradient flux condition. I have several species in a table, and I want the first derivative for them to be zero. For a single species I don’t have the problem, but I can’t transfer it to get it for a longer list.

This how I write it down for the single species

"Zero Gradient condition" BC = Derivative[1, 0]  [Cl][L, t] == 0

For more species I define first a BC for each species and then write all in a list

dspecies = {Cl, Ca, Na}
BC[Cl] = 0;
BC[Ca] = 0;
BC[Na] = 0;

BCdspecies = Table[dspecies[[i]][L, t] == BC[dspecies[[i]]], {i, 1,Length[dspecies]}];

I don't see where I can get here the first derivative. May someone know how this works?

Cheers Chris

POSTED BY: Chis Schmidt
2 Replies

Hi Chris,

I am not sure whether I understood your question correctly. Maybe this is doing what you want:

ClearAll["Global`*"];
dspecies = {Cl, Ca, Na};
Evaluate[BC[#] & /@ dspecies] = Thread[(Derivative[1, 0][#][L, t] & /@ dspecies) == 0]

Check the result with:

?BC

Regards -- Henrik

POSTED BY: Henrik Schachner
Posted 10 years ago

Thank you very much! That works perfect!

POSTED BY: Chis Schmidt
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract