acer

32348 Reputation

29 Badges

19 years, 330 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

What do you mean by "the data points"? How did you obtain this "numeric solution of [a] differential equation"? Also, presumably you meant interpolation by piecewise splines.

If these data points were obtained from dsolve(...,numeric) then there why interpolate at all, since the returned result involves procedure that can compute on-demand at arbitrary values (using their own interpolants)?

It seems key to first find out why you are interpolating from a set of data points. What are all the things that you will do with the interpolant?

So far you haven't described anything that requires interpolating from a finite set of data points. You could do better for obtaining, say, further integrals or derivatives by modifying/augmenting the original system of DEs and solving (as dharr described).

Upload and attach your worksheet using the green up-arrow in the Mapleprimes editor.

@mmcdara Sure.

I'd like to see Statistics:-NonlinearFit offer use of a global optimizer in general, with a variety of different objectives offered.

@mmcdara Yes, there are various mechanisms for doing similar. Using signum is nice and clean.

Originally I was writing code that programmatically determined the data splits and did fancy stuff. But then I reflected that the OP hadn't provided much backdrop and context, so threw it away.

I happened to choose,
     piecewise(x<=0, Fn, -eval(Fn,x=-x))
using only one of the formulas, because I was still mentally stuck on some general idea.

@mmcdara There are enough things unclear in the Question that I wasn't going to worry. (Is the OP looking for a globally best fit? Any fit? Is this the full data set? Etc.)

I recall that the OP's previous Question was also muddled.

[edit] If I cared a great deal about the quality of the fit then I wouldn't have rounded the coefficients to half-a-dozen decimal places. I was hoping that that OP would respond with some clarification, prompted by what I'd shown.

@Reshu Gupta Please don't submit this as a separate Question, just because nobody has answered it yet. (I have deleted two duplicates, so far.)

If you are impatient, you could look over this response to a recent and similar request about exporting dsolve,numeric data.

@Al86 Somehow you have entered what I gave as invalid 2D Input. I provided plaintext 1D Maple notation. 

I have no idea what you did, and it's almost impossible to guess because you have only pasted in an error message instead of attaching your actual document. That is not helpful.

If I paste it into a paragraph of a Document in 2D Input mode then it works for me.
 sigh.mw

@Al86 Here are two ways, given you expression (with parameters).

HH := 5*log[10]((c/H_0)*Int(1/(A*(1+zp)^4+B*(1+z)^3+C)^(1/2)/10,
                            zp=0..z,
                            method=_d01ajc, epsilon=1e-5)):

# 1st way, plots:-display and multiple `plot` calls.

plots:-display(
  plot(eval(HH,[A=2, B=3, C=4, H_0=1, c=299792458]), z=1e-7 .. 1.0,
       thickness=3, color=red, smartview=false),
  plot(eval(HH,[A=4, B=5, C=7, H_0=1, c=299792458]), z=1e-7 .. 1.0,
       thickness=3, color=blue, smartview=false),
  plot(eval(HH,[A=8, B=7, C=11, H_0=1, c=299792458]), z=1e-7 .. 1.0,
       thickness=3, color=green, smartview=false)
);

# 2nd way, a single `plot` call, with a list of expressions.

plot( [ eval(HH,[A=2, B=3, C=4, H_0=1, c=299792458]),
        eval(HH,[A=4, B=5, C=7, H_0=1, c=299792458]),
        eval(HH,[A=8, B=7, C=11, H_0=1, c=299792458]) ],
     z=1e-7 .. 1.0,
     color=[red,blue,green],
     thickness=3, smartview=false);

@mary120 In your Maple 11 the elementwise operation denoted by rhs~ would not work. You could try changing part of Tom's code to map the rhs command, instead.

In particular, this piece,

res:= Matrix( [ [ x, U1(x)],
                  seq( map(rhs,sol(j)[1..2]), j=0..20)
                ]
              );

See revised attachment,  q_ac.mw

@tomleslie The Question was tagged as Maple 11 prior to your asking about it.

@Pemudahijrah01 You can follow the instruction in my Answer, to obtain an explicit solution. It will be huge.

If might be smaller if there were some conditions on the unknown parameters. Could you provide any?

What do you intend on doing with the solution?

@tomleslie As is indicated at the top of this thread, the OP is running Maple 11.

@NeillSmith That is why I asked (a few times) whether it would be adequate if only the D form were to be prettyprinted as you asked.

You can use the green up-arrow in the Mapleprimes editor to upload and attach files, and to inline .mw worksheets here.

restart;

with(Typesetting):
Settings(typesetprime=true):
Suppress(f(x)):

 

convert( eval(diff(f(x),x), x=3), D )

(D(f))(3)

eval(convert( Eval(diff(f(x),x), x=3), D ));

(D(f))(3)

eqn := f(x)^2 = (diff(f(x),x) + 7)^2 + diff(f(x),x,x)/15;

f(x)^2 = (diff(f(x), x)+7)^2+(1/15)*(diff(diff(f(x), x), x))

convert( eval(eqn, x=3), D );

f(3)^2 = ((D(f))(3)+7)^2+(1/15)*((D@@2)(f))(3)

eval(convert( Eval(eqn, x=3), D ));

f(3)^2 = ((D(f))(3)+7)^2+(1/15)*((D@@2)(f))(3)

 

Download prime_D.mw

I realize that you also want f(x) to display as is. That's a concession, when using Suppress(f(x)) . I have a way to get both the D(f)(3) form as well as f(x) to print as you want, while not suppressing the argument in the printing of f(x), but it involves a (re)implementation of `print/D` which maybe too dodgy.

@Al86 Use the plots:-display command to put multiple plots together.

You can simply put three plot calls inside that, each with its own values for A,B,C. (There are other ways, but that way you don't have the burden of understanding and remembering even more syntax.)

Are you going to clarify your earlier syntax, to let me know whether I got its meaning close to right? There's also the matter of scale, units, and accuracy.

@rlopez Yes, that's why I was asking whether the OP would be OK with just the D form working. It wasn't clear to me whether he really needed eval(diff(f(x),x),x=0) or its inert Eval form to also work, since both appeared in his worksheet.

But I suspect that you intended,
   D(f)(0)
instead of,
   D(f)(x)(0)
[edit] Those both prettyprint the same, in the form that was requested. But only the first of them makes proper sense in the context of the Question.

First 167 168 169 170 171 172 173 Last Page 169 of 592